Package com.adobe.granite.ui.components
Class Config
java.lang.Object
com.adobe.granite.ui.components.Config
The config properties of a resource.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe resource name for datasource config ("datasource").static StringThe resource name for the defaults config ("defaults").static StringThe resource name for items ("items").static StringThe resource name for layout config ("layout").static StringThe resource name for render condition config ("rendercondition"). -
Constructor Summary
ConstructorsConstructorDescriptionAlias ofConfig(Resource, boolean)with inherit isfalse.Create a new Config object for the given resource.Create a new Config object for the given resource. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of property with the given name, converted to string.<T> TReturns the value of property with the given name, converted into the given type.<T> TReturns the value of property with the given name, converted into the given type.Returns the child resource with the given name.Returns the default properties that will be applied to child elements.getInherited(String name) Returns the value of property with the given name, converted to string.<T> TgetInherited(String name, Class<T> type) Returns the value of property with the given name, converted into the given type.<T> TgetInherited(String name, T defaultValue) Returns the value of property with the given name, converted into the given type.getInheritedDefault(String name) Alias ofget(String).<T> TgetInheritedDefault(String name, Class<T> type) Alias ofget(String, Class).<T> TgetInheritedDefault(String name, T defaultValue) Alias ofget(String, Object);getItems()Returns the child resources ofITEMSsub-resource.Returns the child resources of the sub-resource with the given name.Returns the child resources ofITEMSsub-resource of the given resource.Returns the child resources of the sub resource with the given name of the given resource.Returns the parent of the resource.Returns the properties of the resource merged with the default properties.
-
Field Details
-
DEFAULTS
The resource name for the defaults config ("defaults"). -
ITEMS
The resource name for items ("items"). -
LAYOUT
The resource name for layout config ("layout"). -
DATASOURCE
The resource name for datasource config ("datasource"). -
RENDERCONDITION
The resource name for render condition config ("rendercondition").
-
-
Constructor Details
-
Config
Alias ofConfig(Resource, boolean)with inherit isfalse.- Parameters:
resource- The resource
-
Config
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:
-
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 Details
-
get
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
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
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
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:
-
getInherited
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:
-
getInherited
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:
-
getInheritedDefault
Alias ofget(String).- Parameters:
name- The name of the property- Returns:
- The value of property with the given name, converted to string
-
getInheritedDefault
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
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
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
Returns the properties of the resource merged with the default properties.- Returns:
- The value map containing the properties merged with the default properties.
-
getItems
Returns the child resources ofITEMSsub-resource.- Returns:
- The child resources of the specified
ITEMSsub-resource
-
getItems
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
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 Iterator<Resource> getItems(@CheckForNull Resource resource, @CheckForNull String name) Returns the child resources of the sub resource with the given name of the given resource.- Parameters:
resource- The resourcename- The name of the resource- Returns:
- the child resources of the sub resource with the given name of the given resource.
-
getChild
Returns the child resource with the given name.- Parameters:
name- The name of the resource- Returns:
- The child 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
-