public class AggregateConfig extends Object implements Configuration
NO_DATA, NO_DEFAULT
Constructor and Description |
---|
AggregateConfig(Configuration config,
String[] configArgs)
Create an AggregateConfig
|
AggregateConfig(Configuration config,
String[] configArgs,
ClassLoader loader)
Create an AggregateConfig
|
AggregateConfig(String[] configs)
Create an AggregateConfig
|
AggregateConfig(String[] configs,
ClassLoader loader)
Create an AggregateConfig
|
Modifier and Type | Method and Description |
---|---|
Configuration |
getCommonConfiguration()
Get the common configuration this class was created with
|
Object |
getEntry(String component,
String name,
Class type)
Returns an object of the specified type created using the information in
the entry matching the specified component and name, which must be
found, and supplying no data.
|
Object |
getEntry(String component,
String name,
Class type,
Object defaultValue)
Returns an object of the specified type created using the information in
the entry matching the specified component and name, and supplying no
data, returning the default value if no matching entry is found and the
default value is not
Configuration.NO_DEFAULT . |
Object |
getEntry(String component,
String name,
Class type,
Object defaultValue,
Object data)
Returns an object of the specified type created using the information in
the entry matching the specified component and name, and using the
specified data (unless it is
Configuration.NO_DATA ), returning the default
value if no matching entry is found and the default value is not Configuration.NO_DEFAULT . |
public AggregateConfig(Configuration config, String[] configArgs) throws ConfigurationException
config
- The "common" ConfigurationconfigArgs
- Configuration arguments which may declare entries of the
form $component_entry. These entries will be resolved in the "common"
Configuration. Parsing of the end config would be done by ConfigurationFile
which delegates special entry resolution to this class.ConfigurationException
public AggregateConfig(Configuration config, String[] configArgs, ClassLoader loader) throws ConfigurationException
config
- - The "common" ConfigurationconfigArgs
- - Configuration arguments which may declare entries of the
form $component_entry. These entries will be resolved in the "common"
Configuration. Parsing of the end config would be done by ConfigurationFile
which delegates special entry resolution to this class.loader
- - The class loader to use for interpreting class namesConfigurationException
public AggregateConfig(String[] configs) throws ConfigurationException
configs
- An array of configArgs, where the common config is
specified as the last element of the array. The first element of the array
defines the config which may may declare entries of the
form $component_entry. These entries will be resolved in the "common"
Configuration. Parsing of the end config would be done by ConfigurationFile
which delegates special entry resolution to this class.ConfigurationException
public AggregateConfig(String[] configs, ClassLoader loader) throws ConfigurationException
configs
- An array of configArgs, where the common config is
specified as the last element of the array. The first element of the array
defines the config which may may declare entries of the
form $component_entry. These entries will be resolved in the "common"
Configuration. Parsing of the end config would be done by ConfigurationFile
which delegates special entry resolution to this class.loader
- - The class loader to use for interpreting class namesConfigurationException
public Configuration getCommonConfiguration()
Configuration
object.public Object getEntry(String component, String name, Class type) throws ConfigurationException
Configuration
type
is a primitive type,
then the result is returned as an instance of the associated wrapper
class. Repeated calls with the same arguments may or may not return the
identical object.
The component
identifies the object whose behavior will be
configured using the object returned. The value of
component
must be a QualifiedIdentifier, as defined
in the Java(TM) Language Specification (JLS), and is
typically the class or package name of the object being configured. The
name
identifies which of possibly several entries are
available for the given component. The value of name
must
be an Identifier, as defined in the JLS.
Calling this method is equivalent to calling
.getEntry
(component,
name, type, Configuration.NO_DEFAULT
, Configuration.NO_DATA
)
getEntry
in interface Configuration
component
- the component being configuredname
- the name of the entry for the componenttype
- the type of the object to be returnedcomponent
and name
NoSuchEntryException
- if no matching entry is foundConfigurationException
- if a matching entry is found but a
problem occurs creating the object for the entry, or if
type
is a reference type and the result for the matching
entry is not either null
or an instance of
type
, or if type
is a primitive type and the
result is not an instance of the associated wrapper class. Any
Error
thrown while creating the object is propagated to the
caller; it is not wrapped in a ConfigurationException
.Configuration.getEntry(String, String, Class, Object)
public Object getEntry(String component, String name, Class type, Object defaultValue) throws ConfigurationException
Configuration
Configuration.NO_DEFAULT
. If type
is a
primitive type, then the result is returned as an instance of the
associated wrapper class. Repeated calls with the same arguments may or
may not return the identical object.
The component
identifies the object whose behavior will be
configured using the object returned. The value of
component
must be a QualifiedIdentifier, as defined
in the Java Language Specification (JLS), and is typically
the class or package name of the object being configured. The
name
identifies which of possibly several entries are
available for the given component. The value of name
must
be an Identifier, as defined in the JLS.
Calling this method is equivalent to calling
.getEntry
(component,
name, type, defaultValue, Configuration.NO_DATA
)
getEntry
in interface Configuration
component
- the component being configuredname
- the name of the entry for the componenttype
- the type of the object to be returneddefaultValue
- the object to return if no matching entry is found,
or NO_DEFAULT
to specify no defaultcomponent
and name
, or
defaultValue
if no matching entry is found and
defaultValue
is not NO_DEFAULT
NoSuchEntryException
- if no matching entry is found and
defaultValue
is NO_DEFAULT
ConfigurationException
- if a matching entry is found but a
problem occurs creating the object for the entry, or if
type
is a reference type and the result for the matching
entry is not either null
or an instance of
type
, or if type
is a primitive type and the
result is not an instance of the associated wrapper class. Any
Error
thrown while creating the object is propagated to the
caller; it is not wrapped in a ConfigurationException
.Configuration.getEntry(String, String, Class, Object, Object)
public Object getEntry(String component, String name, Class type, Object defaultValue, Object data) throws ConfigurationException
Configuration
Configuration.NO_DATA
), returning the default
value if no matching entry is found and the default value is not Configuration.NO_DEFAULT
. If type
is a primitive type, then the result
is returned as an instance of the associated wrapper class. Repeated
calls with the same arguments may or may not return the identical
object.
The component
identifies the object whose behavior will be
configured using the object returned. The value of
component
must be a QualifiedIdentifier, as defined
in the Java Language Specification (JLS), and is typically
the class or package name of the object being configured. The
name
identifies which of possibly several entries are
available for the given component. The value of name
must
be an Identifier, as defined in the JLS.
getEntry
in interface Configuration
component
- the component being configuredname
- the name of the entry for the componenttype
- the type of the object to be returneddefaultValue
- the object to return if no matching entry is found,
or NO_DEFAULT
to specify no defaultdata
- an object to use when computing the value of the entry, or
NO_DATA
to specify no datacomponent
and name
, and using the value of
data
(unless it is NO_DATA
), or
defaultValue
if no matching entry is found and
defaultValue
is not NO_DEFAULT
NoSuchEntryException
- if no matching entry is found and
defaultValue
is NO_DEFAULT
ConfigurationException
- if a matching entry is found but a
problem occurs creating the object for the entry, or if
type
is a reference type and the result for the matching
entry is not either null
or an instance of
type
, or if type
is a primitive type and the
result is not an instance of the associated wrapper class. Any
Error
thrown while creating the object is propagated to the
caller; it is not wrapped in a ConfigurationException
.Copyright © GigaSpaces.