Class AbstractResource

    • Constructor Detail

      • AbstractResource

        public AbstractResource()
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of this resource.

        This method is implemented as a pure string operation by calling the ResourceUtil.getName(String) method with the path of this resource.

        Specified by:
        getName in interface Resource
        Returns:
        The resource name
      • getChild

        public Resource getChild​(java.lang.String relPath)
        Returns the indicated child of this resource.

        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.

        Specified by:
        getChild in interface Resource
        Parameters:
        relPath - relative path to the child resource
        Returns:
        The child resource or null
        See Also:
        ResourceResolver.getResource(Resource, String)
      • getChildren

        public java.lang.Iterable<Resource> getChildren()
        Description copied from interface: Resource
        Returns an iterable of the direct children of this resource.

        This method is a convenience and returns exactly the same resources as calling getResourceResolver().getChildren(resource).

        Specified by:
        getChildren in interface Resource
        Returns:
        An iterable for child resources
        See Also:
        Resource.getChildren()
      • isResourceType

        public boolean isResourceType​(java.lang.String resourceType)
        Returns true if this resource is of the given resource type or if any of the super resource types equals the given resource type.

        This method delegates to ResourceResolver.isResourceType(Resource, String)

        Specified by:
        isResourceType in interface Resource
        Parameters:
        resourceType - the resource type to check this resource against
        Returns:
        true if the resource type or any of the resource's super type(s) equals the given resource type, false otherwise; false can also be returned if resourceType is null
        See Also:
        ResourceResolver.isResourceType(Resource, String)
      • getValueMap

        public ValueMap getValueMap()
        This method calls Adaptable.adaptTo(Class) with the ValueMap class as an argument. If the adaptTo method returns a map, this map is returned. If the resource is not adaptable to a value map, next an adaption to Map is tried and if this is successful the map is wrapped as a value map. If the adaptions are not successful an empty value map is returned.
        Specified by:
        getValueMap in interface Resource
        Returns:
        A value map
        See Also:
        Resource.getValueMap()