This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git
The following commit(s) were added to refs/heads/master by this push:
new 8acf0c648 Clarify conversion of Enum to String
8acf0c648 is described below
commit 8acf0c648c5faf9e0fd4aadb3578ac159cde35b9
Author: Konrad Windszus <[email protected]>
AuthorDate: Wed May 14 12:19:47 2025 +0200
Clarify conversion of Enum to String
---
src/main/jbake/content/documentation/bundles/scripting/scripting-htl.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/src/main/jbake/content/documentation/bundles/scripting/scripting-htl.md
b/src/main/jbake/content/documentation/bundles/scripting/scripting-htl.md
index e700fa2db..cc6e6a654 100644
--- a/src/main/jbake/content/documentation/bundles/scripting/scripting-htl.md
+++ b/src/main/jbake/content/documentation/bundles/scripting/scripting-htl.md
@@ -63,7 +63,7 @@ The HTL Specification talks about the following types which
are supported to be
HTL Type | Conversion from Java Type | Code Link
--- | --- | ---
`Boolean` | `java.lang.Boolean` (no conversion necessary). In addition it
returns `true` for every other Java object except for `null`,
`java.lang.Number` having value `0`, empty String, array, Collection, Map,
Iterator or Iterable's iterator |
[`ObjectModel.toBoolean(Object)`](https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/org.apache.sling.scripting.sightly.runtime-1.2.4-1.4.0/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java#L151)
-`String` | Almost every type via `Object.toString()`. `Collections` are
handled differently, by joining their elements. All types supported since HTL
Runtime 1.2.6-1.4.0
([SLING-9968](https://issues.apache.org/jira/browse/SLING-9968)).|
[`ObjectModel.toString(Object)`](https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/org.apache.sling.scripting.sightly.runtime-1.2.4-1.4.0/src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java#L238)
+`String` | Almost every type uses `Object.toString()` except for `Collections`
which are joining their elements (converted to String) separated with `,` and
`Enum` which is leveraging `Enum.name` (not `Enum.toString()). All types
supported since HTL Runtime 1.2.6-1.4.0
([SLING-9968](https://issues.apache.org/jira/browse/SLING-9968)).|
[`ObjectModel.toString(Object)`](https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/org.apache.sling.scripting.sightly.runtime
[...]
`Date` | `java.util.Date`, `java.util.Calendar`, `java.time.Instant`
([SLING-10651](https://issues.apache.org/jira/browse/SLING-10651)) |
[`AbstractRuntimeObjectModel.toDate(Object)`](https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/6bcc04f159290aac39f0f6fa725da0a87f59076b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java#L91)
`Number` | `java.lang.Number`, every other type first converted to
`java.lang.String` and then converted to Number via
[`NumberUtils.createNumber(String)`](https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/math/NumberUtils.html#createNumber-java.lang.String-).
|
[`ObjectModel.toNumber(Object)`](https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/blob/org.apache.sling.scripting.sightly.runtime-1.2.4-1.4.0/src/main/java/org/apache/sling/
[...]
`Collection` | `java.util.Collection`, `java.util.Iterator`,
`java.lang.Iterable`, `java.util.Enumeration` and arrays return the underlying
list or collection. `java.lang.String` or `java.lang.Number` are converted to a
list containing the object as single item. For `java.util.Map` the key set is
used. Everything else returns an empty list till HTL Runtime 1.2.4-1.4.0, newer
versions return a single item list containing the object
([SLING-10679](https://issues.apache.org/jira/browse/SLIN [...]