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:10:09 UTC

[sling-org-apache-sling-scripting-sightly-compiler] 05/15: 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-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler.git

commit cae1ea2ec2c237bf8f3596d047ce101fc66347a8
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/compiler@1751880 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/scripting/sightly/impl/compiler/CompileTimeObjectModel.java   | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/CompileTimeObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/CompileTimeObjectModel.java
index 0a93194..af8bfc7 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/CompileTimeObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/compiler/CompileTimeObjectModel.java
@@ -130,6 +130,8 @@ public final class CompileTimeObjectModel {
                 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>.