enapps-enorman opened a new pull request #13:
URL: https://github.com/apache/sling-org-apache-sling-scripting-sightly/pull/13
For a use case where you need access to an enum value in your ui script for
some reason, it would be nice to be able to "data-sly-use" your enum class with
something like this:
<sly data-sly-use.myEnum="org.hello.MyEnum"></sly>
... and then later on you can reference the enum values with an expression
that looks something like this:
<p>
Enum value by name: ${myEnum.SOMEVALUE}
</p>
<p>
Enum value by ordinal: ${myEnum[1]}
</p>
<p>
Constant static field within the enum:
${myEnum.SOME_NON_VALUE_CONSTANT_FIELD}
</p>
<p data-sly-repeat.value="${myEnum.values}">
Enum value[${value.ordinal}] from static method call: ${value}
</p>
NOTE: for the expressions to work, you will also need the companion PR at:
https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/pull/8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]