public interface Accessible
Node
and Page
instances.Modifier and Type | Method and Description |
---|---|
org.apache.sling.api.resource.ValueMap |
asMap() |
<T> com.google.common.base.Optional<T> |
get(String propertyName,
Class<T> type)
Get a property value from the current node.
|
<T> T |
get(String propertyName,
T defaultValue)
Get a property value from the current node, returning the default value if the property does not exist.
|
com.google.common.base.Optional<String> |
getAsHref(String propertyName)
Given a property on this resource containing the path of another resource, get an
Optional
containing the href to the resource (i.e. |
com.google.common.base.Optional<String> |
getAsHref(String propertyName,
boolean strict)
Given a property on this resource containing the path of another resource, get an
Optional
containing the href to the resource. |
com.google.common.base.Optional<String> |
getAsHref(String propertyName,
boolean strict,
boolean mapped)
Given a property on this resource containing the path of another resource, get an
Optional
containing the href to the resource. |
com.google.common.base.Optional<Link> |
getAsLink(String propertyName)
Given a property on this resource containing the path of another resource, get a link to the resource.
|
com.google.common.base.Optional<Link> |
getAsLink(String propertyName,
boolean strict)
Given a property on this resource containing the path of another resource, get a link to the resource.
|
com.google.common.base.Optional<Link> |
getAsLink(String propertyName,
boolean strict,
boolean mapped)
Given a property on this resource containing the path of another resource, get a link to the resource.
|
<T> List<T> |
getAsList(String propertyName,
Class<T> type)
Get a multi-valued property from the current node as a list of the given type.
|
com.google.common.base.Optional<PageDecorator> |
getAsPage(String propertyName)
Get a page instance from the value of the given property.
|
<AdapterType> |
getAsType(String propertyName,
Class<AdapterType> type)
Get an
Optional type instance for a property on this resource containing the path of another
Resource in the repository. |
com.google.common.base.Optional<String> |
getImageReference()
Get the referenced DAM asset path for the default image (named "image") for this component.
|
com.google.common.base.Optional<String> |
getImageReference(boolean isSelf)
Get the referenced DAM asset path for the default image (named "image") for this component.
|
com.google.common.base.Optional<String> |
getImageReference(String name) |
com.google.common.base.Optional<String> |
getImageRendition(String renditionName)
Get the DAM asset rendition path for the default image (named "image") for this component.
|
com.google.common.base.Optional<String> |
getImageRendition(String name,
String renditionName) |
org.apache.sling.api.resource.ValueMap asMap()
<T> T get(String propertyName, T defaultValue)
T
- property typepropertyName
- property namedefaultValue
- default value<T> com.google.common.base.Optional<T> get(String propertyName, Class<T> type)
ValueMap
wrapped in an Optional
instance instead of returning null.T
- property typepropertyName
- property nametype
- property typeOptional
of the given type containing the property value or absent if the property does not
existcom.google.common.base.Optional<String> getAsHref(String propertyName)
Optional
containing the href to the resource (i.e. the content path with ".html" appended).propertyName
- name of property containing a valid content pathOptional
com.google.common.base.Optional<String> getAsHref(String propertyName, boolean strict)
Optional
containing the href to the resource. Use this method with a true
argument when appending ".html" to
the resource path is desired only for valid CQ pages and not external paths.propertyName
- name of property containing a valid content pathstrict
- if true, strict resource resolution will be applied and only valid CQ content paths will have
".html" appendedOptional
com.google.common.base.Optional<String> getAsHref(String propertyName, boolean strict, boolean mapped)
Optional
containing the href to the resource. Use this method with a true
argument when appending ".html" to
the resource path is desired only for valid CQ pages and not external paths. Setting mapped
to
true
will map the path value, if it exists, through the Sling Resource Resolver.propertyName
- name of property containing a valid content pathstrict
- if true, strict resource resolution will be applied and only valid CQ content paths will have
".html" appendedmapped
- if true, the property value will be routed through the Resource Resolver to determine the mapped
path for the value. For example, if a mapping from "/content/" to "/" exists in the Apache Sling Resource
Resolver Factory OSGi configuration, getting the mapped href for the path "/content/citytechinc" will return
"/citytechinc.html".Optional
com.google.common.base.Optional<Link> getAsLink(String propertyName)
propertyName
- name of property containing a valid content pathOptional
link object, absent if property does not contain a valid content pathcom.google.common.base.Optional<Link> getAsLink(String propertyName, boolean strict)
true
argument when including an extension for the link is desired only for valid CQ
pages and not external paths.propertyName
- name of property containing a valid content pathstrict
- if true, strict resource resolution will be applied and only valid CQ content paths will have an
extensionOptional
link object, absent if property does not contain a valid content pathcom.google.common.base.Optional<Link> getAsLink(String propertyName, boolean strict, boolean mapped)
true
argument when including an extension for the link is desired only for valid CQ
pages and not external paths. Setting mapped
to true
will map the path value, if it
exists, through the Sling Resource Resolver.propertyName
- name of property containing a valid content pathstrict
- if true, strict resource resolution will be applied and only valid CQ content paths will have an
extensionmapped
- if true, the property value will be routed through the Resource Resolver to determine the mapped
path for the value. For example, if a mapping from "/content/" to "/" exists in the Apache Sling Resource
Resolver Factory OSGi configuration, the Link
path will be "/citytechinc" rather than
"/content/citytechinc".Optional
link object, absent if property does not contain a valid content path<T> List<T> getAsList(String propertyName, Class<T> type)
T
- property type, must be supported by ValueMap
propertyName
- name of multi-valued propertytype
- property typecom.google.common.base.Optional<PageDecorator> getAsPage(String propertyName)
Optional
if the
path value for the given property name does not resolve to a valid CQ page.propertyName
- property nameOptional
page for property value<AdapterType> com.google.common.base.Optional<AdapterType> getAsType(String propertyName, Class<AdapterType> type)
Optional
type instance for a property on this resource containing the path of another
Resource
in the repository.AdapterType
- adapter class that is adaptable from Resource
propertyName
- name of property containing a resource pathtype
- type to adapt from resourceOptional
instance of the specified type, or absent if either the property does not exist or
the resource does not adapt to the provided typecom.google.common.base.Optional<String> getImageReference(boolean isSelf)
isSelf
- if true, image reference property will be accessed from the current resource rather than a childOptional
image reference pathcom.google.common.base.Optional<String> getImageReference()
Optional
image reference pathcom.google.common.base.Optional<String> getImageReference(String name)
name
- image nameOptional
image reference pathcom.google.common.base.Optional<String> getImageRendition(String renditionName)
renditionName
- rendition name for this asset (e.g. "cq5dam.thumbnail.140.100.png")Optional
image rendition pathCopyright © 2019 ICF Next. All rights reserved.