Class AbstractComputedProperty<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accepts​(com.day.cq.dam.api.Asset asset, String propertyName)  
      boolean accepts​(com.day.cq.dam.api.Asset asset, org.apache.sling.api.SlingHttpServletRequest request, String propertyName)  
      T get​(com.day.cq.dam.api.Asset asset)
      Gets the computed value for the asset.
      T get​(com.day.cq.dam.api.Asset asset, org.apache.sling.api.resource.ValueMap parameters)
      Gets the computed value for the asset.
      T get​(com.day.cq.dam.api.Asset asset, org.apache.sling.api.SlingHttpServletRequest request)
      Gets the computed value for the asset.
      T get​(com.day.cq.dam.api.Asset asset, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.ValueMap parameters)
      Gets the computed value for the asset.
      protected org.apache.sling.api.resource.ValueMap getAssetProperties​(com.day.cq.dam.api.Asset asset)  
      protected com.day.cq.wcm.api.components.ComponentContext getComponentContext​(org.apache.sling.api.SlingHttpServletRequest request)  
      protected org.apache.sling.api.resource.ValueMap getMetadataProperties​(com.day.cq.dam.api.Asset asset)  
      boolean isCachable()
      Method that indicates if the result via (get(..)) is cacheable by the ComputedPropertyAccessor.
    • Constructor Detail

      • AbstractComputedProperty

        public AbstractComputedProperty()
    • Method Detail

      • getComponentContext

        protected com.day.cq.wcm.api.components.ComponentContext getComponentContext​(org.apache.sling.api.SlingHttpServletRequest request)
      • getAssetProperties

        protected org.apache.sling.api.resource.ValueMap getAssetProperties​(com.day.cq.dam.api.Asset asset)
      • getMetadataProperties

        protected org.apache.sling.api.resource.ValueMap getMetadataProperties​(com.day.cq.dam.api.Asset asset)
      • isCachable

        public boolean isCachable()
        Description copied from interface: ComputedProperty
        Method that indicates if the result via (get(..)) is cacheable by the ComputedPropertyAccessor. This is highly encouraged if the same computed property is called many times in the context of the same Accessor (ie Model) and the resulting value will not/should not change.

        The AbstractComputedProperty's implementation of this method returns true as this is the common use case.

        Specified by:
        isCachable in interface ComputedProperty<T>
        Returns:
        true if the value is cachable by the consumer of the ComputedProperty.
      • accepts

        public boolean accepts​(com.day.cq.dam.api.Asset asset,
                               String propertyName)
        Specified by:
        accepts in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        propertyName - the computed property name
        Returns:
        true if this ComputedProperty should accept the handling of this invocation.
      • accepts

        public boolean accepts​(com.day.cq.dam.api.Asset asset,
                               org.apache.sling.api.SlingHttpServletRequest request,
                               String propertyName)
        Specified by:
        accepts in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        request - the request object
        propertyName - the computed property name
        Returns:
        true if this ComputedProperty should accept the handling of this invocation.
      • get

        public T get​(com.day.cq.dam.api.Asset asset,
                     org.apache.sling.api.SlingHttpServletRequest request,
                     org.apache.sling.api.resource.ValueMap parameters)
        Description copied from interface: ComputedProperty
        Gets the computed value for the asset.
        This is the primary get(..) method signature to implement as this is what is exposed from AssetModel's CombinedProperties
        Specified by:
        get in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        request - the request
        parameters - any parameters. If this method is implemented, it should handle the case where no parameters
        Returns:
        the computed value.
      • get

        public T get​(com.day.cq.dam.api.Asset asset,
                     org.apache.sling.api.SlingHttpServletRequest request)
        Description copied from interface: ComputedProperty
        Gets the computed value for the asset.
        Specified by:
        get in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        request - the request
        Returns:
        the computed value.
      • get

        public T get​(com.day.cq.dam.api.Asset asset,
                     org.apache.sling.api.resource.ValueMap parameters)
        Description copied from interface: ComputedProperty
        Gets the computed value for the asset.
        Specified by:
        get in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        parameters - any parameters. If this method is implemented, it should handle the case where no parametersters
        Returns:
        the computed value.
      • get

        public T get​(com.day.cq.dam.api.Asset asset)
        Description copied from interface: ComputedProperty
        Gets the computed value for the asset.
        Specified by:
        get in interface ComputedProperty<T>
        Parameters:
        asset - the asset
        Returns:
        the computed value.