You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:11:05 UTC

[sling-org-apache-sling-scripting-sightly-compiler] 04/11: SLING-5825 - Add support for implicit conversion of Enum to String

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.compiler.java-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler.git

commit 8dd902aae1a1febd389819b0018941645bb7384b
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Fri Jul 8 11:20:36 2016 +0000

    SLING-5825 - Add support for implicit conversion of Enum to String
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/java-compiler@1751880 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/scripting/sightly/render/AbstractRuntimeObjectModel.java      | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
index aa42104..a55b21f 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
@@ -130,6 +130,8 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
                 output = (String) obj;
             } else if (isPrimitive(obj)) {
                 output = obj.toString();
+            } else if (obj instanceof Enum) {
+                return ((Enum) obj).name();
             } else {
                 Collection<?> col = obtainCollection(obj);
                 if (col != null) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.