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.
|
@Nonnull public static java.lang.String DEFAULTS
@Nonnull public static java.lang.String ITEMS
@Nonnull public static java.lang.String LAYOUT
@Nonnull public static java.lang.String DATASOURCE
@Nonnull public static java.lang.String RENDERCONDITION
public Config(@CheckForNull Resource resource)
Config(Resource, boolean)
with inherit is false
.resource
- The resourcepublic Config(@CheckForNull 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(@CheckForNull Resource resource, @CheckForNull ValueMap defaults, @CheckForNull 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.@Nonnull public java.lang.String get(@Nonnull java.lang.String name)
name
- the name of the property@Nonnull public <T> T get(@Nonnull java.lang.String name, @Nonnull 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.@CheckForNull public <T> T get(@Nonnull java.lang.String name, @Nonnull 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 to@Nonnull public java.lang.String getInherited(@Nonnull java.lang.String name)
name
- The name of the propertygetParentResource()
@Nonnull public <T> T getInherited(@Nonnull java.lang.String name, @Nonnull 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()
@CheckForNull public <T> T getInherited(@Nonnull java.lang.String name, @Nonnull 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()
@Nonnull public java.lang.String getInheritedDefault(@Nonnull java.lang.String name)
get(String)
.name
- The name of the property@Nonnull public <T> T getInheritedDefault(@Nonnull java.lang.String name, @Nonnull 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.@CheckForNull public <T> T getInheritedDefault(@Nonnull java.lang.String name, @Nonnull 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 to@Nonnull public ValueMap getDefaultProperties()
@Nonnull public ValueMap getProperties()
@Nonnull public java.util.Iterator<Resource> getItems()
ITEMS
sub-resource.ITEMS
sub-resource@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull java.lang.String name)
name
- The name of the resource@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull Resource resource)
ITEMS
sub-resource of the given
resource.resource
- The resourceITEMS
sub-resource of the given
resource@Nonnull public java.util.Iterator<Resource> getItems(@CheckForNull Resource resource, @CheckForNull java.lang.String name)
name
- The name of the resourceresource
- The resource@CheckForNull public Resource getChild(@Nonnull java.lang.String name)
name
- The name of the resource@CheckForNull public 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. All Rights Reserved