Package com.adobe.granite.ui.components
Class ValueMapResourceWrapper
- java.lang.Object
-
- org.apache.sling.api.resource.ResourceWrapper
-
- com.adobe.granite.ui.components.ValueMapResourceWrapper
-
public class ValueMapResourceWrapper extends ResourceWrapper
A resource wrapper that wraps an underlying resource with an emptyValueMap
}, which can be modified accordingly. It is used for the scenario where we want to control the ValueMap returned by a resource.
-
-
Field Summary
-
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
-
Constructor Summary
Constructors Constructor Description ValueMapResourceWrapper(Resource resource, java.lang.String resourceType)
Instantiates a new wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <AdapterType>
AdapterTypeadaptTo(java.lang.Class<AdapterType> type)
Returns the value of callingadaptTo
on thewrapped resource
.java.lang.String
getResourceType()
Returns the value of callinggetResourceType
on thewrapped resource
.ValueMap
getValueMap()
Returns a value map for this resource.-
Methods inherited from class org.apache.sling.api.resource.ResourceWrapper
getChild, getChildren, getName, getParent, getPath, getResource, getResourceMetadata, getResourceResolver, getResourceSuperType, hasChildren, isResourceType, listChildren, toString
-
-
-
-
Constructor Detail
-
ValueMapResourceWrapper
public ValueMapResourceWrapper(@Nonnull Resource resource, java.lang.String resourceType)
Instantiates a new wrapper.- Parameters:
resource
- The resource to wrapresourceType
- The resource type of the resource wrapper
-
-
Method Detail
-
getResourceType
public java.lang.String getResourceType()
Description copied from class:ResourceWrapper
Returns the value of callinggetResourceType
on thewrapped resource
.- Specified by:
getResourceType
in interfaceResource
- Overrides:
getResourceType
in classResourceWrapper
- Returns:
- The resource type
-
adaptTo
public <AdapterType> AdapterType adaptTo(java.lang.Class<AdapterType> type)
Description copied from class:ResourceWrapper
Returns the value of callingadaptTo
on thewrapped resource
.- Specified by:
adaptTo
in interfaceAdaptable
- Overrides:
adaptTo
in classResourceWrapper
- Type Parameters:
AdapterType
- The generic type to which this object is adapted to- Parameters:
type
- The Class object of the target type, such asjavax.jcr.Node.class
orjava.io.File.class
- Returns:
- The adapter target or
null
if the object cannot adapt to the requested type
-
getValueMap
public ValueMap getValueMap()
Description copied from interface:Resource
Returns a value map for this resource. The value map allows to read the properties of the resource.- Specified by:
getValueMap
in interfaceResource
- Overrides:
getValueMap
in classResourceWrapper
- Returns:
- A value map
- See Also:
Resource.getValueMap()
-
-