public class SlingFunctions
extends java.lang.Object
Constructor and Description |
---|
SlingFunctions() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
adaptTo(Adaptable adaptable,
java.lang.String adapter)
Adapt the adaptable to the adapter class.
|
static java.lang.String |
encode(java.lang.String value,
java.lang.String mode)
XSS encodes the specified text using the specified mode.
|
static java.util.Iterator<Resource> |
findResources(ResourceResolver resourceResolver,
java.lang.String query,
java.lang.String language)
Searches for resources using the given query formulated in the given
language.
|
static Resource |
getRelativeResource(Resource base,
java.lang.String path)
Gets the resource at the relative path to the provided resource.
|
static Resource |
getResource(ResourceResolver resolver,
java.lang.String path)
Method allow for the retrieval of resources.
|
static <E> E |
getValue(ValueMap properties,
java.lang.String key,
java.lang.Object defaultOrType)
Gets the value of the specified key from the ValueMap and either coerses
the value into the specified type or uses the specified type as a default
depending on the parameter passed in.
|
static boolean |
hasChildren(Resource resource)
Method for checking whether or not a resource has child resources.
|
static java.util.Iterator<Resource> |
listChildren(Resource resource)
Method for allowing the invocation of the Sling Resource listChildren
method.
|
public static java.lang.Object adaptTo(Adaptable adaptable, java.lang.String adapter) throws java.lang.ClassNotFoundException
adaptable
- the adaptable instanceadapter
- the class to which to adapt the adaptablejava.lang.ClassNotFoundException
public static java.lang.String encode(java.lang.String value, java.lang.String mode)
value
- The text to encodemode
- The XSS mode to use, see XSSSupport for the list of available modespublic static java.util.Iterator<Resource> findResources(ResourceResolver resourceResolver, java.lang.String query, java.lang.String language)
resourceResolver
- query
- The query string to use to find the resources.language
- The language in which the query is formulated.public static Resource getRelativeResource(Resource base, java.lang.String path)
base
- the resource relative to which to find the pathpath
- the relative path at which to find the resourcepublic static final Resource getResource(ResourceResolver resolver, java.lang.String path)
resolver
- the current resource resolverpath
- the path of the resource to retrievepublic static final <E> E getValue(ValueMap properties, java.lang.String key, java.lang.Object defaultOrType)
properties
- the ValueMap from which to retrieve the valuekey
- the key for the value to retrievedefaultOrType
- either the default value or the class to which to coerce the
valuepublic static final boolean hasChildren(Resource resource)
resource
- the resource to check for child resourcespublic static final java.util.Iterator<Resource> listChildren(Resource resource)
resource
- the resource of which to list the childrenResource.listChildren()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"