You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Eric Norman (Jira)" <ji...@apache.org> on 2021/07/27 21:41:00 UTC

[jira] [Commented] (SLING-5825) Add support for implicit conversion of Enum to String

    [ https://issues.apache.org/jira/browse/SLING-5825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17388310#comment-17388310 ] 

Eric Norman commented on SLING-5825:
------------------------------------

[~kwin] [~radu] Do you recall if there was there ever an answer to your question regarding usage of Enum.name() vs Enum.toString()? 

It appears that ObjectModel#toString handles this now and still uses Enum.name(), and I was wondering if there was some specific reason why that was done.

> Add support for implicit conversion of Enum to String
> -----------------------------------------------------
>
>                 Key: SLING-5825
>                 URL: https://issues.apache.org/jira/browse/SLING-5825
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>    Affects Versions: Scripting Sightly Engine 1.0.2
>            Reporter: Konrad Windszus
>            Assignee: Radu Cotescu
>            Priority: Minor
>             Fix For: Scripting HTL Engine 1.0.20
>
>
> Currently Sightly does not support implicit conversion from Enum to String like in 
> {code}
> <div class="${member.inviteStatus}">...</div>
> {code}
> The class attribute will always be empty in case when {{member.inviteStatus}} is an Enum.
> Instead you have to write
> {code}
> <div class="${member.inviteStatus.toString}">...</div>
> {code}
> Sightly should implicitly convert enums to Strings if they are just given out.
> This is similar to SLING-5053.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)