Package com.sun.jini.config
Class Config
java.lang.Object
com.sun.jini.config.Config
Provides static methods for getting entries from a
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) |
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatgetFloatEntry(Configuration config, String component, String name, float defaultValue, float min, float max) Obtains afloatthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.static intgetIntEntry(Configuration config, String component, String name, int defaultValue, int min, int max) Obtains anintthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.static longgetLongEntry(Configuration config, String component, String name, long defaultValue, long min, long max) Obtains alongthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.static ObjectgetNonNullEntry(Configuration config, String component, String name, Class type) Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.static ObjectgetNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue) Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.static ObjectgetNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue, Object data) Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.
-
Method Details
-
getNonNullEntry
public static Object getNonNullEntry(Configuration config, String component, String name, Class type) throws ConfigurationException Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.Calling this method is equivalent to calling
.getNonNullEntry(config, component, name, type,Configuration.NO_DEFAULT,Configuration.NO_DATA)- Parameters:
config- theConfigurationbeing consulted.component- the component being configuredname- the name of the entry for the componenttype- the type of the object to be returned- Returns:
- a non-
nullobject obtained from callingconfig.getEntryusing the other passed arguments - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoesNullPointerException- if any of the arguments arenull- See Also:
-
getNonNullEntry
public static Object getNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue) throws ConfigurationException Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.Calling this method is equivalent to calling
.getNonNullEntry(config, component, name, type, defaultValue,Configuration.NO_DATA)- Parameters:
config- theConfigurationbeing 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 found- Returns:
- a non-
nullobject obtained from callingconfig.getEntryusing the other passed arguments - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoesNullPointerException- if any of the arguments arenull- See Also:
-
getNonNullEntry
public static Object getNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue, Object data) throws ConfigurationException Obtains a non-nullobject from the specifiedConfigurationusing the specified arguments.Calling this method is equivalent to calling
config.after ensuring thatgetEntry(component, name, type, defaultValue, data)defaultValueis non-nulland throwingConfigurationExceptionif the result isnull.- Parameters:
config- theConfigurationbeing 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, orConfiguration#NO_DATAto specify no data- Returns:
- a non-
nullobject obtained from callingconfig.getEntryusing the other passed arguments - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoesNullPointerException- if theconfig,component,name,type, ordefaultValuearguments arenull- See Also:
-
getLongEntry
public static long getLongEntry(Configuration config, String component, String name, long defaultValue, long min, long max) throws ConfigurationException Obtains alongthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.- Parameters:
config- theConfigurationbeing consulted.component- the component being configuredname- the name of the entry for the componentdefaultValue- thelongto return if no matching entry is foundmin- the minimum value the entry should havemax- the maximum value the entry should have- Returns:
- a long obtained from calling
config.getEntryusingcomponent,name, anddefaultValue. - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull, or if returned value is not betweenminandmax, inclusive. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoes, ifdefaultValueis not betweenminandmaxinclusive, or ifminis larger thanmaxNullPointerException- ifconfig,componentornameisnull.- See Also:
-
getIntEntry
public static int getIntEntry(Configuration config, String component, String name, int defaultValue, int min, int max) throws ConfigurationException Obtains anintthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.- Parameters:
config- theConfigurationbeing consulted.component- the component being configuredname- the name of the entry for the componentdefaultValue- theintto return if no matching entry is foundmin- the minimum value the entry should havemax- the maximum value the entry should have- Returns:
- a int obtained from calling
config.getEntryusingcomponent,name, anddefaultValue. - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull, or if returned value is not betweenminandmax, inclusive. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoes, ifdefaultValueis not betweenminandmaxinclusive, or ifminis larger thanmaxNullPointerException- ifconfig,componentornameisnull.- See Also:
-
getFloatEntry
public static float getFloatEntry(Configuration config, String component, String name, float defaultValue, float min, float max) throws ConfigurationException Obtains afloatthat falls within the given inclusive range from the specifiedConfigurationusing the specified component and entry names.- Parameters:
config- theConfigurationbeing consulted.component- the component being configuredname- the name of the entry for the componentdefaultValue- thefloatto return if no matching entry is foundmin- the minimum value the entry should havemax- the maximum value the entry should have- Returns:
- a float obtained from calling
config.getEntryusingcomponent,name, anddefaultValue. - Throws:
NoSuchEntryException- if the underlying call toconfig.getEntrydoesConfigurationException- if the underlying call toconfig.getEntrydoes, or if the returned entry isnull, or if returned value is not betweenminandmax, inclusive. AnyErrorthrown while creating the object is propagated to the caller; it is not wrapped in aConfigurationExceptionIllegalArgumentException- if the underlying call toconfig.getEntrydoes, ifdefaultValueis not betweenminandmaxinclusive, or ifminis larger thanmaxNullPointerException- ifconfig,componentornameisnull.- See Also:
-