Closed guiguilechat closed 4 years ago
Will review it after my vacation :) looks good
Enjoy the vacation :)
maybe instead of enumRef, overload the lit() method ? At first I searched in the lit because I thought it would be there. Not sure though, it's not a litteral value but a litteral reference.
I now added a method enumConstantRef
to AbstractJClass
so that you can basically code like this:
cm.ref (MyEnum.class).enumConstantRef ("ENUM1")
- I don't want to bloat the JCodeModel
class with these utility methods - there would be hundreds of them. Please tell if that already helps.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I assume it is okay. Part of v3.2.4
sorry if this is already present, did not find it.
I already have this code in a common class :
I want to use JCodeModel to create the class B:
I create the definedclass bclass, create the constructor, but when I want to set super(enum1) I need to call
JExpr.enumConstantRef(cm.ref(MyEnum.class), enum1.name())
I think it would be easier to add an enumRef in JCodeModel that allow to refer to an enum constant more easily. eg
(did not test this code, maybe the idea is bad - it compiles but :P )