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 callingadaptToon thewrapped resource.java.lang.StringgetResourceType()Returns the value of callinggetResourceTypeon thewrapped resource.ValueMapgetValueMap()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:ResourceWrapperReturns the value of callinggetResourceTypeon thewrapped resource.- Specified by:
getResourceTypein interfaceResource- Overrides:
getResourceTypein classResourceWrapper- Returns:
- The resource type
-
adaptTo
public <AdapterType> AdapterType adaptTo(java.lang.Class<AdapterType> type)
Description copied from class:ResourceWrapperReturns the value of callingadaptToon thewrapped resource.- Specified by:
adaptToin interfaceAdaptable- Overrides:
adaptToin 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.classorjava.io.File.class- Returns:
- The adapter target or
nullif the object cannot adapt to the requested type
-
getValueMap
public ValueMap getValueMap()
Description copied from interface:ResourceReturns a value map for this resource. The value map allows to read the properties of the resource.- Specified by:
getValueMapin interfaceResource- Overrides:
getValueMapin classResourceWrapper- Returns:
- A value map
- See Also:
Resource.getValueMap()
-
-