Package com.day.cq.wcm.commons.policy
Class ContentPolicyStyle
- java.lang.Object
-
- com.day.cq.wcm.commons.policy.ContentPolicyStyle
-
public class ContentPolicyStyle extends Object implements Style
A compatibility wrapper using a content policy as a style. The goal is to use components using the currentStyle binding with the new content policies, without the need to change the component. This will not be a complete style implementation but rather focuses on the reading of the map values.- Since:
- 6.1
-
-
Constructor Summary
Constructors Constructor Description ContentPolicyStyle(ContentPolicy contentPolicy, Cell cell)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object o)booleancontainsValue(Object o)Set<Map.Entry<String,Object>>entrySet()Objectget(Object o)<T> Tget(String name, Class<T> type)Return named value converted to type T ornullif not existing.<T> Tget(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 existCellgetCell()Returns the cell of this styleStringgetDefiningPath(String name)Returns the cell path that defines the style property with the given name.ResourcegetDefiningResource(String name)Returns the resource that defines the style property with the given name.DesigngetDesign()Returns the design this style is defined in.StringgetPath()Returns the path to this cell resourceStylegetSubStyle(String relPath)Returns a sub style for the give one, by virtually extending the cell stack.booleanisEmpty()Set<String>keySet()Objectput(String s, Object o)voidputAll(Map<? extends String,?> map)Objectremove(Object o)intsize()Collection<Object>values()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
ContentPolicyStyle
public ContentPolicyStyle(ContentPolicy contentPolicy, Cell cell)
-
-
Method Detail
-
getDesign
public Design getDesign()
Description copied from interface:StyleReturns the design this style is defined in.
-
getPath
public String getPath()
Description copied from interface:StyleReturns the path to this cell resource
-
getCell
public Cell getCell()
Description copied from interface:StyleReturns the cell of this style
-
get
public <T> T get(String name, Class<T> type)
Description copied from interface:StyleReturn named value converted to type T ornullif not existing. Please note that this also supports aResourceclass as type in order to retrieve a style resource (e.g. image)
-
get
public <T> T get(String name, T defaultValue)
Description copied from interface:Stylereturn named value converted to the type T of the default value or the default value if the named value does not exist
-
getDefiningResource
public Resource getDefiningResource(String name)
Description copied from interface:StyleReturns the resource that defines the style property with the given name.- Specified by:
getDefiningResourcein interfaceStyle- Parameters:
name- name of the style property- Returns:
- resource or
null
-
getDefiningPath
public String getDefiningPath(String name)
Description copied from interface:StyleReturns the cell path that defines the style property with the given name.- Specified by:
getDefiningPathin interfaceStyle- Parameters:
name- name of the style property- Returns:
- path or
null
-
getSubStyle
public Style getSubStyle(String relPath)
Description copied from interface:StyleReturns a sub style for the give one, by virtually extending the cell stack.- Specified by:
getSubStylein interfaceStyle- Parameters:
relPath- relative path of the sub style.- Returns:
- the new style
-
containsKey
public boolean containsKey(Object o)
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
public boolean containsValue(Object o)
- Specified by:
containsValuein interfaceMap<String,Object>
-
-