I need to write a function that accepts a class object and checks whether the argument is the EnumSet of enums implementing a specific interface.
Below is the function I currently have, but it only checks whether the class is an EnumSet, but I'm not able to assess it's Enum.
I have an interface
public interface EnumWithOrdinalValue {
long getOrdinalValue();
}
Some enums in code implement it, some don't and I need to filter out the later.
public boolean isMatching(@Nonnull Class<?> aClass) {
boolean retval = false;
retval |= EnumSet.class.isAssignableFrom(aClass);
return retval;
}
Aucun commentaire:
Enregistrer un commentaire