private String description;
private int number;
- EtherTypes(String description, int number) {
+ EtherTypes(final String description, final int number) {
this.description = description;
this.number = number;
}
return ((Integer) number).shortValue();
}
- public static String getEtherTypeName(int number) {
+ public static String getEtherTypeName(final int number) {
return getEtherTypeInternal(number);
}
- public static String getEtherTypeName(short number) {
+ public static String getEtherTypeName(final short number) {
return getEtherTypeInternal(number & 0xffff);
}
- public static String getEtherTypeName(byte number) {
+ public static String getEtherTypeName(final byte number) {
return getEtherTypeInternal(number & 0xff);
}
- private static String getEtherTypeInternal(int number) {
+ private static String getEtherTypeInternal(final int number) {
for (EtherTypes type : EtherTypes.values()) {
if (type.number == number) {
return type.toString();
return "0x" + Integer.toHexString(number);
}
- public static short getEtherTypeNumberShort(String name) {
+ public static short getEtherTypeNumberShort(final String name) {
if (name.matches(regexNumberString)) {
return Short.valueOf(name);
}
return 0;
}
- public static int getEtherTypeNumberInt(String name) {
+ public static int getEtherTypeNumberInt(final String name) {
if (name.matches(regexNumberString)) {
return Integer.valueOf(name);
}
return ethertypesList;
}
- public static EtherTypes loadFromString(String string) {
+ public static EtherTypes loadFromString(final String string) {
int intType = Integer.parseInt(string);
for (EtherTypes type : EtherTypes.values()) {