public class Config extends Object
Configuration. This class cannot be instantiated.
This class uses the Logger named
net.jini.config to log information at
the following logging levels:
| Level | Description |
|---|---|
| FINE | entries that are found, but do not meet the specified constraints (e.g. are null) |
| Modifier and Type | Method and Description |
|---|---|
static float |
getFloatEntry(Configuration config,
String component,
String name,
float defaultValue,
float min,
float max)
Obtains a
float that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names. |
static int |
getIntEntry(Configuration config,
String component,
String name,
int defaultValue,
int min,
int max)
Obtains an
int that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names. |
static long |
getLongEntry(Configuration config,
String component,
String name,
long defaultValue,
long min,
long max)
Obtains a
long that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names. |
static <T> T |
getNonNullEntry(Configuration config,
String component,
String name,
Class<T> type)
Obtains a non-
null object from the specified
Configuration using the specified arguments. |
static <T> T |
getNonNullEntry(Configuration config,
String component,
String name,
Class<T> type,
Object defaultValue)
Obtains a non-
null object from the specified
Configuration using the specified arguments. |
static <T> T |
getNonNullEntry(Configuration config,
String component,
String name,
Class<T> type,
Object defaultValue,
Object data)
Obtains a non-
null object from the specified
Configuration using the specified arguments. |
public static <T> T getNonNullEntry(Configuration config, String component, String name, Class<T> type) throws ConfigurationException
null object from the specified
Configuration using the specified arguments.
Calling this method is equivalent to calling .getNonNullEntry(config, component, name, type,
Configuration.NO_DEFAULT,
Configuration.NO_DATA)
T - the type of the object to be returned.config - the Configuration being consulted.component - the component being configuredname - the name of the entry for the componenttype - the type of the object to be returnednull object obtained from
calling config.getEntry using
the other passed argumentsNoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry doesNullPointerException - if any of the arguments are
nullConfiguration.getEntry(String, String, Class),
getNonNullEntry(Configuration, String, String, Class, Object,
Object)public static <T> T getNonNullEntry(Configuration config, String component, String name, Class<T> type, Object defaultValue) throws ConfigurationException
null object from the specified
Configuration using the specified arguments.
Calling this method is equivalent to calling .getNonNullEntry(config, component, name, type, defaultValue,
Configuration.NO_DATA)
T - the type of the object to be returned.config - the Configuration being consulted.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
foundnull object obtained from
calling config.getEntry using
the other passed argumentsNoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry doesNullPointerException - if any of the arguments are
nullConfiguration.getEntry(String, String, Class, Object, Object),
getNonNullEntry(Configuration, String, String, Class, Object,
Object)public static <T> T getNonNullEntry(Configuration config, String component, String name, Class<T> type, Object defaultValue, Object data) throws ConfigurationException
null object from the specified
Configuration using the specified arguments.
Calling this method is equivalent to calling
config. after ensuring that
getEntry(component, name, type,
defaultValue, data)defaultValue is non-null and throwing
ConfigurationException if the result is
null.
T - the type of the object to be returned.config - the Configuration being consulted.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
founddata - an object to use when computing the value of the
entry, or Configuration#NO_DATA to specify
no datanull object obtained from
calling config.getEntry using
the other passed argumentsNoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry doesNullPointerException - if the config,
component, name, type,
or defaultValue arguments are nullConfiguration.getEntry(String, String, Class, Object, Object),
getNonNullEntry(Configuration, String, String, Class, Object,
Object)public static long getLongEntry(Configuration config, String component, String name, long defaultValue, long min, long max) throws ConfigurationException
long that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names.config - the Configuration being consulted.component - the component being configuredname - the name of the entry for the componentdefaultValue - the long to return if no matching
entry is foundmin - the minimum value the entry should havemax - the maximum value the entry should haveconfig.getEntry
using component, name,
and defaultValue.NoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null, or if
returned value is not between min and
max, inclusive.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry does, if
defaultValue is not between
min and max inclusive,
or if min is larger than maxNullPointerException - if config,
component or name is
null.Configuration.getEntry(String, String, Class, Object)public static int getIntEntry(Configuration config, String component, String name, int defaultValue, int min, int max) throws ConfigurationException
int that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names.config - the Configuration being consulted.component - the component being configuredname - the name of the entry for the componentdefaultValue - the int to return if no matching
entry is foundmin - the minimum value the entry should havemax - the maximum value the entry should haveconfig.getEntry
using component, name,
and defaultValue.NoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null, or if
returned value is not between min and
max, inclusive.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry does, if
defaultValue is not between
min and max inclusive,
or if min is larger than maxNullPointerException - if config,
component or name is
null.Configuration.getEntry(String, String, Class, Object)public static float getFloatEntry(Configuration config, String component, String name, float defaultValue, float min, float max) throws ConfigurationException
float that falls within the given inclusive
range from the specified Configuration using the specified
component and entry names.config - the Configuration being consulted.component - the component being configuredname - the name of the entry for the componentdefaultValue - the float to return if no matching
entry is foundmin - the minimum value the entry should havemax - the maximum value the entry should haveconfig.getEntry
using component, name,
and defaultValue.NoSuchEntryException - if the underlying call to
config.getEntry doesConfigurationException - if the underlying call to
config.getEntry does, or if the
returned entry is null, or if
returned value is not between min and
max, inclusive.
Any Error thrown while creating the object
is propagated to the caller; it is not wrapped in a
ConfigurationExceptionIllegalArgumentException - if the underlying call to
config.getEntry does, if
defaultValue is not between
min and max inclusive,
or if min is larger than maxNullPointerException - if config,
component or name is
null.Configuration.getEntry(String, String, Class, Object)Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.