Interface Style

  • All Superinterfaces:
    java.util.Map<java.lang.String,​java.lang.Object>, ValueMap
    All Known Implementing Classes:
    ContentPolicyStyle

    public interface Style
    extends ValueMap
    A style contains properties that reflect the design aspect of a cell.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      • Fields inherited from interface org.apache.sling.api.resource.ValueMap

        EMPTY
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T get​(java.lang.String name, java.lang.Class<T> type)
      Return named value converted to type T or null if not existing.
      <T> T get​(java.lang.String name, T defaultValue)
      return named value converted to the type T of the default value or the default value if the named value does not exist
      Cell getCell()
      Returns the cell of this style
      java.lang.String getDefiningPath​(java.lang.String name)
      Returns the cell path that defines the style property with the given name.
      Resource getDefiningResource​(java.lang.String name)
      Returns the resource that defines the style property with the given name.
      Design getDesign()
      Returns the design this style is defined in.
      java.lang.String getPath()
      Returns the path to this cell resource
      Style getSubStyle​(java.lang.String relPath)
      Returns a sub style for the give one, by virtually extending the cell stack.
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Method Detail

      • getDesign

        Design getDesign()
        Returns the design this style is defined in.
        Returns:
        the design.
      • getPath

        java.lang.String getPath()
        Returns the path to this cell resource
        Returns:
        the path
      • getCell

        Cell getCell()
        Returns the cell of this style
        Returns:
        the cell
      • get

        <T> T get​(java.lang.String name,
                  java.lang.Class<T> type)
        Return named value converted to type T or null if not existing. Please note that this also supports a Resource class as type in order to retrieve a style resource (e.g. image)
        Specified by:
        get in interface ValueMap
        Type Parameters:
        T - The class of the type
        Parameters:
        name - the name of the property or resource
        type - The class of the type
        Returns:
        Return named value converted to type T or null if non existing or can't be converted.
      • get

        <T> T get​(java.lang.String name,
                  T defaultValue)
        return named value converted to the type T of the default value or the default value if the named value does not exist
        Specified by:
        get in interface ValueMap
        Type Parameters:
        T - The expected type
        Parameters:
        name - the name of the property
        defaultValue - the default value
        Returns:
        the value.
      • getDefiningResource

        Resource getDefiningResource​(java.lang.String name)
        Returns the resource that defines the style property with the given name.
        Parameters:
        name - name of the style property
        Returns:
        resource or null
      • getDefiningPath

        java.lang.String getDefiningPath​(java.lang.String name)
        Returns the cell path that defines the style property with the given name.
        Parameters:
        name - name of the style property
        Returns:
        path or null
      • getSubStyle

        Style getSubStyle​(java.lang.String relPath)
        Returns a sub style for the give one, by virtually extending the cell stack.
        Parameters:
        relPath - relative path of the sub style.
        Returns:
        the new style