I have the following class:
public class EnumContainer{
private Class<?> enumClass;
//GET, SET
public EnumContainer(Class<?> clazz){
this.enumClass = clazz;
}
public boolean tryCast(String value){
//Here I should try to cast the String to the Enum by enumClass field
//return true if cast was successfull
//false otherwise
}
}
Is it even possible in Java to perform such casting?
Aucun commentaire:
Enregistrer un commentaire