Hello,
Is there any Method to check whether a JType (object of type
JClass/JDefinedClass) has an enum or not, an to get the constants of the
enum?
And are there any tricks to create a JClass from String expression? Just
something similar to Class.forName. I've searched the API, but didn't
find one.
I'm trying to initialize an Object referred by the EnumConstant.
For Ex:
Class A is abstract, and has subclass of class B & C
So class A Definition looks like this.
Class A
{
enum Type{
B,
C
}
}
And there is a class which has a field of type A.
Class Root
{
A aField;
}
I want to add a method to initialize this aField with the expected
sublcass.
So it should look like this
Void addA( A.Type type)
{
String typeStr = type.getString();
Class clazz = Class.forName(typeStr);
aField = new clazz();
}
Is there any way to accomplish this???
Thanks.
Best Regards,
Heru