public class Config extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DATASOURCE
The resource name for datasource config ("datasource").
|
static String |
DEFAULTS
The resource name for the defaults config ("defaults").
|
static String |
ITEMS
The resource name for items ("items").
|
static String |
LAYOUT
The resource name for layout config ("layout").
|
static String |
RENDERCONDITION
The resource name for render condition config ("rendercondition").
|
Constructor and Description |
---|
Config(Resource resource)
Alias of
Config(Resource, boolean) with inherit is
false . |
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.
|
Modifier and Type | Method and Description |
---|---|
String |
get(String name)
Returns the value of property with the given name, converted to string.
|
<T> T |
get(String name,
Class<T> type)
Returns the value of property with the given name, converted into the
given type.
|
<T> T |
get(String name,
T defaultValue)
Returns the value of property with the given name, converted into the
given type.
|
Resource |
getChild(String name)
Returns the child resource with the given name.
|
ValueMap |
getDefaultProperties()
Returns the default properties that will be applied to child elements.
|
String |
getInherited(String name)
Returns the value of property with the given name, converted to string.
|
<T> T |
getInherited(String name,
Class<T> type)
Returns the value of property with the given name, converted into the
given type.
|
<T> T |
getInherited(String name,
T defaultValue)
Returns the value of property with the given name, converted into the
given type.
|
String |
getInheritedDefault(String name)
Alias of
get(String) . |
<T> T |
getInheritedDefault(String name,
Class<T> type)
Alias of
get(String, Class) . |
<T> T |
getInheritedDefault(String name,
T defaultValue)
Alias of
get(String, Object) ; |
Iterator<Resource> |
getItems()
Returns the child resources of
ITEMS sub-resource. |
Iterator<Resource> |
getItems(Resource resource)
Returns the child resources of
ITEMS sub-resource of the given
resource. |
Iterator<Resource> |
getItems(Resource resource,
String name)
Returns the child resources of the sub resource with the given name of
the given resource.
|
Iterator<Resource> |
getItems(String name)
Returns the child resources of the sub-resource with the given name.
|
Resource |
getParentResource()
Returns the parent of the resource.
|
ValueMap |
getProperties()
Returns the properties of the resource merged with the default
properties.
|
public static String DEFAULTS
public static String ITEMS
public static String LAYOUT
public static String DATASOURCE
public static String RENDERCONDITION
public Config(Resource resource)
Config(Resource, boolean)
with inherit is
false
.resource
- The resourcepublic Config(Resource resource, boolean inherit)
inherit
is true
, the default properties are
setup and taken from the parent's DEFAULTS
sub-resource, and
parent properties are used when calling
getInherited(String, Class)
.resource
- The resourceinherit
- Whether to inherit default properties or notgetParentResource()
public Config(Resource resource, ValueMap defaults, ValueMap parentProperties)
resource
- The resourcedefaults
- The default properties. Pass null
if these are
not required.parentProperties
- The properties of the parent resource. Pass null
if these are not required.public String get(String name)
name
- the name of the propertypublic <T> T get(String name, T defaultValue)
T
- The type of the default valuename
- 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 is null
any existing property is not
converted.public <T> T get(String name, Class<T> type)
null
if non existing or can't be converted.T
- The type of the submitted type paramname
- The name of the propertytype
- The type to convert the value of the given property name topublic String getInherited(String name)
name
- The name of the propertygetParentResource()
public <T> T getInherited(String name, T defaultValue)
T
- The type to convert the value of the property toname
- 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 is null
any existing property is not
converted.getParentResource()
public <T> T getInherited(String name, Class<T> type)
null
if non existing or can't be
converted.T
- The type to convert the value of the property toname
- The name of the propertytype
- The type to convert the value of the given property name togetParentResource()
public String getInheritedDefault(String name)
get(String)
.name
- The name of the propertypublic <T> T getInheritedDefault(String name, T defaultValue)
get(String, Object)
;T
- The type to convert the value of the property toname
- 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 is null
any existing property is not
converted.public <T> T getInheritedDefault(String name, Class<T> type)
get(String, Class)
.T
- The type to convert the value of the property toname
- The name of the propertytype
- The type to convert the value of the given property name topublic ValueMap getDefaultProperties()
public ValueMap getProperties()
public Iterator<Resource> getItems()
ITEMS
sub-resource.ITEMS
sub-resourcepublic Iterator<Resource> getItems(String name)
name
- The name of the resourcepublic Iterator<Resource> getItems(Resource resource)
ITEMS
sub-resource of the given
resource.resource
- The resourceITEMS
sub-resource of the
given resourcepublic Iterator<Resource> getItems(Resource resource, String name)
name
- The name of the resourceresource
- The resourcepublic Resource getChild(String name)
name
- The name of the resourcepublic Resource getParentResource()
JcrConstants.NT_UNSTRUCTURED
the direct parent is a
container (e.g. "items") and its parent is returned."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"