public class Config
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATASOURCE
The resource name for datasource config ("datasource").
|
static java.lang.String |
DEFAULTS
The resource name for the defaults config ("defaults").
|
static java.lang.String |
ITEMS
The resource name for items ("items").
|
static java.lang.String |
LAYOUT
The resource name for layout config ("layout").
|
static java.lang.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 |
---|---|
java.lang.String |
get(java.lang.String name)
Returns the value of property with the given name, converted to string.
|
<T> T |
get(java.lang.String name,
java.lang.Class<T> type)
Returns the value of property with the given name, converted into the given
type.
|
<T> T |
get(java.lang.String name,
T defaultValue)
Returns the value of property with the given name, converted into the given
type.
|
Resource |
getChild(java.lang.String name)
Returns the child resource with the given name.
|
ValueMap |
getDefaultProperties()
Returns the default properties that will be applied to child elements.
|
java.lang.String |
getInherited(java.lang.String name)
Returns the value of property with the given name, converted to string.
|
<T> T |
getInherited(java.lang.String name,
java.lang.Class<T> type)
Returns the value of property with the given name, converted into the given
type.
|
<T> T |
getInherited(java.lang.String name,
T defaultValue)
Returns the value of property with the given name, converted into the given
type.
|
java.lang.String |
getInheritedDefault(java.lang.String name)
Alias of
get(String) . |
<T> T |
getInheritedDefault(java.lang.String name,
java.lang.Class<T> type)
Alias of
get(String, Class) . |
<T> T |
getInheritedDefault(java.lang.String name,
T defaultValue)
Alias of
get(String, Object) ; |
java.util.Iterator<Resource> |
getItems()
Returns the child resources of
ITEMS sub-resource. |
java.util.Iterator<Resource> |
getItems(Resource resource)
Returns the child resources of
ITEMS sub-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.
|
java.util.Iterator<Resource> |
getItems(java.lang.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 java.lang.String DEFAULTS
public static java.lang.String ITEMS
public static java.lang.String LAYOUT
public static java.lang.String DATASOURCE
public static java.lang.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 java.lang.String get(java.lang.String name)
name
- the name of the propertypublic <T> T get(java.lang.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(java.lang.String name, java.lang.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 java.lang.String getInherited(java.lang.String name)
name
- The name of the propertygetParentResource()
public <T> T getInherited(java.lang.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(java.lang.String name, java.lang.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 java.lang.String getInheritedDefault(java.lang.String name)
get(String)
.name
- The name of the propertypublic <T> T getInheritedDefault(java.lang.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(java.lang.String name, java.lang.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 java.util.Iterator<Resource> getItems()
ITEMS
sub-resource.ITEMS
sub-resourcepublic java.util.Iterator<Resource> getItems(java.lang.String name)
name
- The name of the resourcepublic java.util.Iterator<Resource> getItems(Resource resource)
ITEMS
sub-resource of the given
resource.resource
- The resourceITEMS
sub-resource of the given
resourcepublic java.util.Iterator<Resource> getItems(Resource resource, java.lang.String name)
name
- The name of the resourceresource
- The resourcepublic Resource getChild(java.lang.String name)
name
- The name of the resourcepublic Resource getParentResource()
JcrConstants.NT_UNSTRUCTURED
, then the parent is a container (e.g.
"items"), then the container's parent is returned instead."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"