private String description;
private int number;
- private EtherTypes(String description, int number) {
+ EtherTypes(String description, int number) {
this.description = description;
this.number = number;
}
}
public static List<String> getEtherTypesNameList() {
- List<String> ethertypesList = new ArrayList<String>();
+ List<String> ethertypesList = new ArrayList<>();
for (EtherTypes type : EtherTypes.values()) {
ethertypesList.add(type.toString());
}
// to add new coming packet classes
public static final Map<Short, Class<? extends Packet>> etherTypeClassMap;
static {
- etherTypeClassMap = new HashMap<Short, Class<? extends Packet>>();
+ etherTypeClassMap = new HashMap<>();
etherTypeClassMap.put(EtherTypes.LLDP.shortValue(), LLDP.class);
}
private static Map<String, Pair<Integer, Integer>> fieldCoordinates = new LinkedHashMap<String, Pair<Integer, Integer>>() {
private static final long serialVersionUID = 1L;
{
- put(DMAC, new ImmutablePair<Integer, Integer>(0, 48));
- put(SMAC, new ImmutablePair<Integer, Integer>(48, 48));
- put(ETHT, new ImmutablePair<Integer, Integer>(96, 16));
+ put(DMAC, new ImmutablePair<>(0, 48));
+ put(SMAC, new ImmutablePair<>(48, 48));
+ put(ETHT, new ImmutablePair<>(96, 16));
}
};
private final Map<String, byte[]> fieldValues;
*/
public Ethernet() {
super();
- fieldValues = new HashMap<String, byte[]>();
+ fieldValues = new HashMap<>();
hdrFieldCoordMap = fieldCoordinates;
hdrFieldsMap = fieldValues;
}
*/
public Ethernet(boolean writeAccess) {
super(writeAccess);
- fieldValues = new HashMap<String, byte[]>();
+ fieldValues = new HashMap<>();
hdrFieldCoordMap = fieldCoordinates;
hdrFieldsMap = fieldValues;
}
private byte value;
- private TLVType(byte value) {
+ TLVType(byte value) {
this.value = value;
}
private static final long serialVersionUID = 1L;
{
- put(TYPE, new MutablePair<Integer, Integer>(0, 7));
- put(LENGTH, new MutablePair<Integer, Integer>(7, 9));
- put(VALUE, new MutablePair<Integer, Integer>(16, 0));
+ put(TYPE, new MutablePair<>(0, 7));
+ put(LENGTH, new MutablePair<>(7, 9));
+ put(VALUE, new MutablePair<>(16, 0));
}
};
*/
public LLDPTLV() {
payload = null;
- fieldValues = new HashMap<String, byte[]>(LLDPTLVFields);
+ fieldValues = new HashMap<>(LLDPTLVFields);
hdrFieldCoordMap = fieldCoordinates;
hdrFieldsMap = fieldValues;
}