Class Config

java.lang.Object
com.sun.jini.config.Config

public class Config extends Object
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 Details

    • getNonNullEntry

      public static Object getNonNullEntry(Configuration config, String component, String name, Class type) throws ConfigurationException
      Obtains a non-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).

      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      type - the type of the object to be returned
      Returns:
      a non-null object obtained from calling config.getEntry using the other passed arguments
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does
      NullPointerException - if any of the arguments are null
      See Also:
    • getNonNullEntry

      public static Object getNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue) throws ConfigurationException
      Obtains a non-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).

      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      type - the type of the object to be returned
      defaultValue - the object to return if no matching entry is found
      Returns:
      a non-null object obtained from calling config.getEntry using the other passed arguments
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does
      NullPointerException - if any of the arguments are null
      See Also:
    • getNonNullEntry

      public static Object getNonNullEntry(Configuration config, String component, String name, Class type, Object defaultValue, Object data) throws ConfigurationException
      Obtains a non-null object from the specified Configuration using the specified arguments.

      Calling this method is equivalent to calling config.getEntry(component, name, type, defaultValue, data) after ensuring that defaultValue is non-null and throwing ConfigurationException if the result is null.

      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      type - the type of the object to be returned
      defaultValue - the object to return if no matching entry is found
      data - an object to use when computing the value of the entry, or Configuration#NO_DATA to specify no data
      Returns:
      a non-null object obtained from calling config.getEntry using the other passed arguments
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does
      NullPointerException - if the config, component, name, type, or defaultValue arguments are null
      See Also:
    • getLongEntry

      public static long getLongEntry(Configuration config, String component, String name, long defaultValue, long min, long max) throws ConfigurationException
      Obtains a long that falls within the given inclusive range from the specified Configuration using the specified component and entry names.
      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      defaultValue - the long to return if no matching entry is found
      min - the minimum value the entry should have
      max - the maximum value the entry should have
      Returns:
      a long obtained from calling config.getEntry using component, name, and defaultValue.
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does, if defaultValue is not between min and max inclusive, or if min is larger than max
      NullPointerException - if config, component or name is null.
      See Also:
    • getIntEntry

      public static int getIntEntry(Configuration config, String component, String name, int defaultValue, int min, int max) throws ConfigurationException
      Obtains an int that falls within the given inclusive range from the specified Configuration using the specified component and entry names.
      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      defaultValue - the int to return if no matching entry is found
      min - the minimum value the entry should have
      max - the maximum value the entry should have
      Returns:
      a int obtained from calling config.getEntry using component, name, and defaultValue.
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does, if defaultValue is not between min and max inclusive, or if min is larger than max
      NullPointerException - if config, component or name is null.
      See Also:
    • getFloatEntry

      public static float getFloatEntry(Configuration config, String component, String name, float defaultValue, float min, float max) throws ConfigurationException
      Obtains a float that falls within the given inclusive range from the specified Configuration using the specified component and entry names.
      Parameters:
      config - the Configuration being consulted.
      component - the component being configured
      name - the name of the entry for the component
      defaultValue - the float to return if no matching entry is found
      min - the minimum value the entry should have
      max - the maximum value the entry should have
      Returns:
      a float obtained from calling config.getEntry using component, name, and defaultValue.
      Throws:
      NoSuchEntryException - if the underlying call to config.getEntry does
      ConfigurationException - 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 ConfigurationException
      IllegalArgumentException - if the underlying call to config.getEntry does, if defaultValue is not between min and max inclusive, or if min is larger than max
      NullPointerException - if config, component or name is null.
      See Also: