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 35b03df54 Add information on type conversion for JCR resource provider 35b03df54 is described below commit 35b03df541cfe4c1f7246f1a04c5c0b7bcc8af8f Author: Konrad Windszus <k...@apache.org> AuthorDate: Sun Apr 6 12:16:28 2025 +0200 Add information on type conversion for JCR resource provider --- .../documentation/the-sling-engine/resources.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/jbake/content/documentation/the-sling-engine/resources.md b/src/main/jbake/content/documentation/the-sling-engine/resources.md index 95104cce3..1b4be5f81 100644 --- a/src/main/jbake/content/documentation/the-sling-engine/resources.md +++ b/src/main/jbake/content/documentation/the-sling-engine/resources.md @@ -144,6 +144,28 @@ Path Parameter | Example Value | Description | Since --- | --- | --- | --- | `v` | `1.0` | Retrieves the underlying JCR node from the [version history](https://docs.adobe.com/docs/en/spec/jcr/2.0/15_Versioning.html) leveraging the version label given in the value. | [SLING-848](https://issues.apache.org/jira/browse/SLING-848) +#### Type Mapping + +The following mapping table is used when writing resource's properties to JCR nodes: + +Java Type | JCR Type +--- | --- +`java.util.Calendar` | Date +`java.io.InputStream` | Binary +`javax.jcr.Node` | Reference +`java.math.BigDecimal` | Decimal +`Long` | Long +`Short` | Long +`Integer` | Long +`Number` | Double +`Boolean` | Boolean +`String` | String +`Serializable` | Binary + +All arrays are stored as multivalue properties. + +For reading a lot more type conversions are supported. + #### Binary Support Binary properties are exposed as `InputStream` in the resource's `ValueMap`. That input stream only needs to be closed in case one reads from it. This prevents always checking the `ValueMap` for dangling `InputStream` properties.