- @Override
- public void parseAttribute(final byte[] bytes, final PathAttributesBuilder builder) {
- builder.setLocalPref(new LocalPrefBuilder().setPref(ByteArray.bytesToLong(bytes)).build());
- }
-}
\ No newline at end of file
+ public static final int TYPE = 5;
+
+ @Override
+ public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) {
+ builder.setLocalPref(new LocalPrefBuilder().setPref(buffer.readUnsignedInt()).build());
+ }
+
+ @Override
+ public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
+ Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+ final LocalPref lp = ((Attributes) attribute).getLocalPref();
+ if (lp == null) {
+ return;
+ }
+ AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.copyInt(lp.getPref().intValue()), byteAggregator);
+ }
+}