alicorn-systems/v8-adapter

Injecting enums

Opened this issue · 1 comments

newk5 commented

Are enums supported? Tried to inject one with .injectClass but always turned out null. If they're not supported, are there plans to support it in the future? Would be really handy for some of my use cases.

caer commented

Hi @newk5 ! Enum fields are not currently supported due to a shortcoming in our API (we do not register properties on injected classes). This is a good future enhancement that we will add to the TODO-list.

For now, you could use the ordinal() method in conjunction with integer passing as a work-around for sharing enum constant information with the Java side...although it is not perfect.