public class ValueMapResource extends SyntheticResource
SyntheticResource
that will return the passed ValueMap when this
resource is adapted to ValueMap.RESOURCE_TYPE_NON_EXISTING
Constructor and Description |
---|
ValueMapResource(ResourceResolver resourceResolver,
ResourceMetadata rm,
java.lang.String resourceType)
Instantiates with an empty ValueMap initially.
|
ValueMapResource(ResourceResolver resourceResolver,
ResourceMetadata rm,
java.lang.String resourceType,
ValueMap vm)
Instantiates with the given ValueMap.
|
ValueMapResource(ResourceResolver resourceResolver,
ResourceMetadata rm,
java.lang.String resourceType,
ValueMap vm,
java.util.Collection<Resource> children)
Instantiates with the given child resources.
|
ValueMapResource(ResourceResolver resourceResolver,
java.lang.String path,
java.lang.String resourceType)
Instantiates with an empty ValueMap initially.
|
ValueMapResource(ResourceResolver resourceResolver,
java.lang.String path,
java.lang.String resourceType,
ValueMap vm)
Instantiates with the given ValueMap.
|
ValueMapResource(ResourceResolver resourceResolver,
java.lang.String path,
java.lang.String resourceType,
ValueMap vm,
java.util.Collection<Resource> children)
Instantiates with the given child resources.
|
Modifier and Type | Method and Description |
---|---|
<Type> Type |
adaptTo(java.lang.Class<Type> type)
Calls into the registered
AdapterManager to adapt this object to
the desired type . |
Resource |
getChild(java.lang.String relPath)
Returns the indicated child of this resource.
|
java.lang.Iterable<Resource> |
getChildren()
Returns an iterable of the direct children of this resource.
|
boolean |
hasChildren()
Checks to see if there are direct children of this resource by invoking
ResourceResolver.hasChildren(Resource) . |
java.util.Iterator<Resource> |
listChildren()
Returns an iterator on the direct child resources.
|
getPath, getResourceMetadata, getResourceResolver, getResourceSuperType, getResourceType, toString
getName, getParent, getValueMap, isResourceType
setAdapterManager, unsetAdapterManager
public ValueMapResource(ResourceResolver resourceResolver, java.lang.String path, java.lang.String resourceType)
resourceResolver
- The resource resolverpath
- The resource pathresourceType
- The resource typepublic ValueMapResource(ResourceResolver resourceResolver, java.lang.String path, java.lang.String resourceType, ValueMap vm)
resourceResolver
- The resource resolverpath
- The resource pathresourceType
- The resource typevm
- The ValueMap of the resourcepublic ValueMapResource(ResourceResolver resourceResolver, java.lang.String path, java.lang.String resourceType, ValueMap vm, java.util.Collection<Resource> children)
resourceResolver
- The resource resolverpath
- The resource pathresourceType
- The resource typevm
- The ValueMap of the resourcechildren
- The children of the resourcepublic ValueMapResource(ResourceResolver resourceResolver, ResourceMetadata rm, java.lang.String resourceType)
resourceResolver
- The resource resolverrm
- The resource meta dataresourceType
- The resource typepublic ValueMapResource(ResourceResolver resourceResolver, ResourceMetadata rm, java.lang.String resourceType, ValueMap vm)
resourceResolver
- The resource resolverrm
- The resource meta dataresourceType
- The resource typevm
- The ValueMap of the resourcepublic ValueMapResource(ResourceResolver resourceResolver, ResourceMetadata rm, java.lang.String resourceType, ValueMap vm, java.util.Collection<Resource> children)
resourceResolver
- The resource resolverrm
- The resource meta dataresourceType
- The resource typevm
- The ValueMap of the resourcechildren
- The children of the resourcepublic <Type> Type adaptTo(java.lang.Class<Type> type)
SlingAdaptable
AdapterManager
to adapt this object to
the desired type
.
This method implements a cache of adapters to improve performance. That is repeated calls to this method with the same class will result in the same object to be returned.
adaptTo
in interface Adaptable
adaptTo
in class SlingAdaptable
Type
- The generic type to which this resource is adapted
totype
- The Class object of the target type, such as
javax.jcr.Node.class
or
java.io.File.class
null
if the resource cannot
adapt to the requested typepublic Resource getChild(java.lang.String relPath)
AbstractResource
This method is implemented calling the
ResourceResolver.getResource(Resource, String)
method. As such
the relPath
argument may even be an absolute path or a path
containing relative path segments .
(current resource) and
..
(parent resource).
Implementations should not generally overwrite this method without calling this base class implementation.
getChild
in interface Resource
getChild
in class AbstractResource
relPath
- relative path to the child resourcenull
ResourceResolver.getResource(Resource, String)
public java.util.Iterator<Resource> listChildren()
AbstractResource
This method is implemented calling the
ResourceResolver.listChildren(Resource)
method.
Implementations should not generally overwrite this method without calling this base class implementation.
listChildren
in interface Resource
listChildren
in class AbstractResource
ResourceResolver.listChildren(Resource)
public java.lang.Iterable<Resource> getChildren()
Resource
This method is a convenience and returns exactly the same resources as
calling getResourceResolver().getChildren(resource)
.
getChildren
in interface Resource
getChildren
in class AbstractResource
Resource.getChildren()
public boolean hasChildren()
AbstractResource
ResourceResolver.hasChildren(Resource)
.hasChildren
in interface Resource
hasChildren
in class AbstractResource
true
if the resource has any child resources"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"