I am trying this example, but can't make it work; it throws The method getFromInt(int) is undefined for the type T
T
is a generic enum type
public static <T> T deserializeEnumeration(InputStream inputStream) {
int asInt = deserializeInt(inputStream);
T deserializeObject = T.getFromInt(asInt);
return deserializeObject;
}
am calling the previous method as follows for example:
objectToDeserialize.setUnit(InputStreamUtil.<Unit>deserializeEnumeration(inputStream));
or
objectToDeserialize.setShuntCompensatorType(InputStreamUtil.<ShuntCompensatorType>deserializeEnumeration(inputStream));
or etc...