Package com.adobe.granite.ui.components
Class Config
- java.lang.Object
 - 
- com.adobe.granite.ui.components.Config
 
 
- 
public class Config extends java.lang.ObjectThe config properties of a resource. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDATASOURCEThe resource name for datasource config ("datasource").static java.lang.StringDEFAULTSThe resource name for the defaults config ("defaults").static java.lang.StringITEMSThe resource name for items ("items").static java.lang.StringLAYOUTThe resource name for layout config ("layout").static java.lang.StringRENDERCONDITIONThe resource name for render condition config ("rendercondition"). 
- 
Constructor Summary
Constructors Constructor Description Config(Resource resource)Alias ofConfig(Resource, boolean)with inherit isfalse.Config(Resource resource, boolean inherit)Create a new Config object for the given resource.Config(Resource resource, ValueMap defaults, ValueMap parentProperties)Create a new Config object for the given resource. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringget(java.lang.String name)Returns the value of property with the given name, converted to string.<T> Tget(java.lang.String name, java.lang.Class<T> type)Returns the value of property with the given name, converted into the given type.<T> Tget(java.lang.String name, T defaultValue)Returns the value of property with the given name, converted into the given type.ResourcegetChild(java.lang.String name)Returns the child resource with the given name.ValueMapgetDefaultProperties()Returns the default properties that will be applied to child elements.java.lang.StringgetInherited(java.lang.String name)Returns the value of property with the given name, converted to string.<T> TgetInherited(java.lang.String name, java.lang.Class<T> type)Returns the value of property with the given name, converted into the given type.<T> TgetInherited(java.lang.String name, T defaultValue)Returns the value of property with the given name, converted into the given type.java.lang.StringgetInheritedDefault(java.lang.String name)Alias ofget(String).<T> TgetInheritedDefault(java.lang.String name, java.lang.Class<T> type)Alias ofget(String, Class).<T> TgetInheritedDefault(java.lang.String name, T defaultValue)Alias ofget(String, Object);java.util.Iterator<Resource>getItems()Returns the child resources ofITEMSsub-resource.java.util.Iterator<Resource>getItems(java.lang.String name)Returns the child resources of the sub-resource with the given name.java.util.Iterator<Resource>getItems(Resource resource)Returns the child resources ofITEMSsub-resource of the given resource.java.util.Iterator<Resource>getItems(Resource resource, java.lang.String name)Returns the child resources of the sub resource with the given name of the given resource.ResourcegetParentResource()Returns the parent of the resource.ValueMapgetProperties()Returns the properties of the resource merged with the default properties. 
 - 
 
- 
- 
Field Detail
- 
DEFAULTS
@Nonnull public static java.lang.String DEFAULTS
The resource name for the defaults config ("defaults"). 
- 
ITEMS
@Nonnull public static java.lang.String ITEMS
The resource name for items ("items"). 
- 
LAYOUT
@Nonnull public static java.lang.String LAYOUT
The resource name for layout config ("layout"). 
- 
DATASOURCE
@Nonnull public static java.lang.String DATASOURCE
The resource name for datasource config ("datasource"). 
- 
RENDERCONDITION
@Nonnull public static java.lang.String RENDERCONDITION
The resource name for render condition config ("rendercondition"). 
 - 
 
- 
Constructor Detail
- 
Config
public Config(@CheckForNull Resource resource)Alias ofConfig(Resource, boolean)with inherit isfalse.- Parameters:
 resource- The resource
 
- 
Config
public Config(@CheckForNull Resource resource, boolean inherit)Create a new Config object for the given resource. Ifinheritistrue, the default properties are setup and taken from the parent'sDEFAULTSsub-resource, and parent properties are used when callinggetInherited(String, Class).- Parameters:
 resource- The resourceinherit- Whether to inherit default properties or not- See Also:
 getParentResource()
 
- 
Config
public Config(@CheckForNull Resource resource, @CheckForNull ValueMap defaults, @CheckForNull ValueMap parentProperties)Create a new Config object for the given resource.- Parameters:
 resource- The resourcedefaults- The default properties. Passnullif these are not required.parentProperties- The properties of the parent resource. Passnullif these are not required.
 
 - 
 
- 
Method Detail
- 
get
@Nonnull public java.lang.String get(@Nonnull java.lang.String name)Returns the value of property with the given name, converted to string. If the property does not exist it is taken from the defaults. Return an empty string if still not existing can't be converted.- Parameters:
 name- the name of the property- Returns:
 - the value of property with the given name, converted to string
 
 
- 
get
@Nonnull public <T> T get(@Nonnull java.lang.String name, @Nonnull T defaultValue)Returns the value of property with the given name, converted into the given type. If the property does not exist it is taken from the defaults. Return the given defaultValue if still non existing or can't be converted.- Type Parameters:
 T- The type of the default value- Parameters:
 name- The name of the propertydefaultValue- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnullany existing property is not converted.- Returns:
 - The value of property with the given name, converted into the given type
 
 
- 
get
@CheckForNull public <T> T get(@Nonnull java.lang.String name, @Nonnull java.lang.Class<T> type)Returns the value of property with the given name, converted into the given type. If the property does not exist, it is taken from the defaults. Returnnullif non existing or can't be converted.- Type Parameters:
 T- The type of the submitted type param- Parameters:
 name- The name of the propertytype- The type to convert the value of the given property name to- Returns:
 - The value of property with the given name, converted into the given type
 
 
- 
getInherited
@Nonnull public java.lang.String getInherited(@Nonnull java.lang.String name)Returns the value of property with the given name, converted to string. If the property does not exist, it is taken from the parent properties. Return an empty string if still not existing can't be converted.- Parameters:
 name- The name of the property- Returns:
 - The value of property with the given name, converted to string.
 - See Also:
 getParentResource()
 
- 
getInherited
@Nonnull public <T> T getInherited(@Nonnull java.lang.String name, @Nonnull T defaultValue)Returns the value of property with the given name, converted into the given type. If the property does not exist, it is taken from the parent properties. Return the given defaultValue if still non existing or can't be converted.- Type Parameters:
 T- The type to convert the value of the property to- Parameters:
 name- The name of the propertydefaultValue- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnullany existing property is not converted.- Returns:
 - The value of property with the given name, converted into the given type
 - See Also:
 getParentResource()
 
- 
getInherited
@CheckForNull public <T> T getInherited(@Nonnull java.lang.String name, @Nonnull java.lang.Class<T> type)Returns the value of property with the given name, converted into the given type. If the property does not exist, it is taken from the parent properties. Returnnullif non existing or can't be converted.- Type Parameters:
 T- The type to convert the value of the property to- Parameters:
 name- The name of the propertytype- The type to convert the value of the given property name to- Returns:
 - The value of property with the given name, converted into the given type
 - See Also:
 getParentResource()
 
- 
getInheritedDefault
@Nonnull public java.lang.String getInheritedDefault(@Nonnull java.lang.String name)Alias ofget(String).- Parameters:
 name- The name of the property- Returns:
 - The value of property with the given name, converted to string
 
 
- 
getInheritedDefault
@Nonnull public <T> T getInheritedDefault(@Nonnull java.lang.String name, @Nonnull T defaultValue)Alias ofget(String, Object);- Type Parameters:
 T- The type to convert the value of the property to- Parameters:
 name- The name of the propertydefaultValue- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnullany existing property is not converted.- Returns:
 - The value of property with the given name, converted to string
 
 
- 
getInheritedDefault
@CheckForNull public <T> T getInheritedDefault(@Nonnull java.lang.String name, @Nonnull java.lang.Class<T> type)Alias ofget(String, Class).- Type Parameters:
 T- The type to convert the value of the property to- Parameters:
 name- The name of the propertytype- The type to convert the value of the given property name to- Returns:
 - The value of property with the given name, converted to string
 
 
- 
getDefaultProperties
@Nonnull public ValueMap getDefaultProperties()
Returns the default properties that will be applied to child elements. Be aware that these are not the defaults that are applied to the resource itself.- Returns:
 - The value map containing the default properties
 
 
- 
getProperties
@Nonnull public ValueMap getProperties()
Returns the properties of the resource merged with the default properties.- Returns:
 - The value map containing the properties merged with the default properties.
 
 
- 
getItems
@Nonnull public java.util.Iterator<Resource> getItems()
Returns the child resources ofITEMSsub-resource.- Returns:
 - The child resources of the specified 
ITEMSsub-resource 
 
- 
getItems
@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull java.lang.String name)
Returns the child resources of the sub-resource with the given name.- Parameters:
 name- The name of the resource- Returns:
 - The child resources of the sub-resource with the given name
 
 
- 
getItems
@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull Resource resource)
Returns the child resources ofITEMSsub-resource of the given resource.- Parameters:
 resource- The resource- Returns:
 - The child resources of the 
ITEMSsub-resource of the given resource 
 
- 
getItems
@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull Resource resource, @CheckForNull java.lang.String name)
Returns the child resources of the sub resource with the given name of the given resource.- Parameters:
 name- The name of the resourceresource- The resource- Returns:
 - the child resources of the sub resource with the given name of the given resource.
 
 
- 
getChild
@CheckForNull public Resource getChild(@Nonnull java.lang.String name)
Returns the child resource with the given name.- Parameters:
 name- The name of the resource- Returns:
 - The child resource
 
 
- 
getParentResource
@CheckForNull public Resource getParentResource()
Returns the parent of the resource. If the parent is of typeJcrConstants.NT_UNSTRUCTURED, then the parent is a container (e.g. "items"), then the container's parent is returned instead.- Returns:
 - The parent of the resource
 
 
 - 
 
 -