/**
* Constructor that creates the tlvList LinkedHashMap and sets the write access for the same
*/
- public LLDP(boolean writeAccess) {
+ public LLDP(final boolean writeAccess) {
super(writeAccess);
init();
}
* - description of the type of TLV
* @return byte - type of TLV
*/
- private byte getType(String typeDesc) {
+ private byte getType(final String typeDesc) {
if (typeDesc.equals(CHASSISID)) {
return LLDPTLV.TLVType.ChassisID.getValue();
} else if (typeDesc.equals(PORTID)) {
}
}
- private LLDPTLV getFromTLVs(Byte type) {
+ private LLDPTLV getFromTLVs(final Byte type) {
LLDPTLV tlv = null;
tlv = mandatoryTLVs.get(type);
if (tlv == null) {
* - description of the type of TLV
* @return LLDPTLV - full TLV
*/
- public LLDPTLV getTLV(String type) {
+ public LLDPTLV getTLV(final String type) {
return getFromTLVs(getType(type));
}
- public LLDPTLV getCustomTLV(CustomTLVKey key) {
+ public LLDPTLV getCustomTLV(final CustomTLVKey key) {
return customTLVs.get(key);
}
* @param tlv
* - tlv to set
*/
- public void setTLV(String type, LLDPTLV tlv) {
+ public void setTLV(final String type, final LLDPTLV tlv) {
putToTLVs(getType(type), tlv);
}
* @param chassisId
* - the chassisId to set
*/
- public LLDP setChassisId(LLDPTLV chassisId) {
+ public LLDP setChassisId(final LLDPTLV chassisId) {
setTLV(CHASSISID, chassisId);
return this;
}
* @param systemNameId
* - the systemNameId to set
*/
- public LLDP setSystemNameId(LLDPTLV systemNameId) {
+ public LLDP setSystemNameId(final LLDPTLV systemNameId) {
setTLV(SYSTEMNAMEID, systemNameId);
return this;
}
* - the portId to set
* @return LLDP
*/
- public LLDP setPortId(LLDPTLV portId) {
+ public LLDP setPortId(final LLDPTLV portId) {
setTLV(PORTID, portId);
return this;
}
* - the ttl to set
* @return LLDP
*/
- public LLDP setTtl(LLDPTLV ttl) {
+ public LLDP setTtl(final LLDPTLV ttl) {
setTLV(TTL, ttl);
return this;
}
* the optionalTLVList to set
* @return LLDP
*/
- public LLDP setOptionalTLVList(List<LLDPTLV> optionalTLVList) {
+ public LLDP setOptionalTLVList(final List<LLDPTLV> optionalTLVList) {
for (LLDPTLV tlv : optionalTLVList) {
optionalTLVs.put(tlv.getType(), tlv);
}
}
@Override
- public Packet deserialize(byte[] data, int bitOffset, int size) throws PacketException {
+ public Packet deserialize(final byte[] data, final int bitOffset, final int size) throws PacketException {
int lldpOffset = bitOffset; // LLDP start
int lldpSize = size; // LLDP size
int numBits = tlv.getTLVSize();
try {
BitBufferHelper.setBytes(serializedBytes, tlv.serialize(), startOffset, numBits);
- } catch (BufferException e) {
+ } catch (final BufferException e) {
throw new PacketException(e.getMessage());
}
startOffset += numBits;
try {
BitBufferHelper.setBytes(serializedBytes, LLDP.emptyTLV.serialize(), startOffset,
LLDP.emptyTLV.getTLVSize());
- } catch (BufferException e) {
+ } catch (final BufferException e) {
throw new PacketException(e.getMessage());
}