alicorn-systems / v8-adapter

Adapter for sharing Java classes and objects with a V8 runtime.
BSD 3-Clause Clear License
37 stars 18 forks source link

Injecting enums #16

Open newk5 opened 6 years ago

newk5 commented 6 years ago

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 6 years ago

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.