Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts2.config
Class DefaultSettings

    java.lang.Object
      org.apache.struts2.config.DefaultSettings

    public class DefaultSettings

extends java.lang.Object

DefaultSettings implements optional methods of Settings.

This class creates and delegates to other settings by using an internal `DelegatingSettings` object.

Field Summary
`protected Logger` | `log` The logging instance for this class.

Constructor Summary
`DefaultSettings()` Constructs an instance by loading the standard property files, any custom property files (`struts.custom.properties`), and any custom message resources ().

Method Summary
`static java.lang.String` | `get(java.lang.String name)` Deprecated. Provides a setting value as a String.
`java.lang.String` | `getImpl(java.lang.String aName)` Implements the `get(String)` method.
`static org.apache.struts2.config.Settings` | `getInstance()` Deprecated. Provides the Settings object.
`static java.util.Locale` | `getLocale()` Deprecated. Provides the Struts default locale.
`static Location` | `getLocation(java.lang.String name)` Deprecated. Provides the Location of a setting.
`Location` | `getLocationImpl(java.lang.String name)` Deprecated. Implements the `getLocation(String)` method.
`static boolean` | `isSet(java.lang.String name)` Deprecated. Determines whether or not a setting has a registered value.
`boolean` | `isSetImpl(java.lang.String aName)` Implements the `isSet(String)` method.
`static java.util.Iterator` | `list()` Deprecated. Provides an Iterator of all properties names.
`java.util.Iterator` | `listImpl()` Implements the `list()` method.
`static void` | `reset()` Deprecated. Resets the default and any plugin Setting instance to null.
`static void` | `set(java.lang.String name, java.lang.String value)` Deprecated. Registers a value for a setting.
`void` | `setImpl(java.lang.String name, java.lang.String value)` Implements the `set(String, String)` method.
`static void` | `setInstance(org.apache.struts2.config.Settings config)` Deprecated. Registers a custom Settings implementation (plugin), and resets the cached locale.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected Logger log

  The logging instance for this class.

Constructor Detail

### DefaultSettings

    public DefaultSettings()

  Constructs an instance by loading the standard property files, any custom property files (`struts.custom.properties`), and any custom message resources ().

  Since this constructor combines Settings from multiple resources, it utilizes a `DelegatingSettings` instance, and all API calls are handled by that instance.

Method Detail

### setImpl

    public void setImpl(java.lang.String name,
                        java.lang.String value)
                 throws java.lang.IllegalArgumentException,
                        java.lang.UnsupportedOperationException

  Implements the `set(String, String)` method.

  Parameters:
    `name` - Identifer for the setting to change.
    `value` - The new value for the setting.
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs when setting the value.
    `java.lang.UnsupportedOperationException` - if the config implementation does not support setting values.
  See Also:
    `set(String, String)`

### getImpl

    public java.lang.String getImpl(java.lang.String aName)
                             throws java.lang.IllegalArgumentException

  Implements the `get(String)` method.

  Parameters:
    `aName` - The name of the setting value to retreive
  Returns:
    The setting value as a String
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs when retrieving the value
  See Also:
    `get(String)`

### isSetImpl

    public boolean isSetImpl(java.lang.String aName)

  Implements the `isSet(String)` method.

  Parameters:
    `aName` - Identifier for the setting value to change
  Returns:
    True if the setting exists and has a value, false otherwise.
  See Also:
    `isSet(String)`

### listImpl

    public java.util.Iterator listImpl()

  Implements the `list()` method.

  Returns:
    A list of the settings as an iterator
  See Also:
    `list()`

### setInstance

    public static void setInstance(org.apache.struts2.config.Settings config)
                            throws java.lang.IllegalStateException

  Deprecated.
  Registers a custom Settings implementation (plugin), and resets the cached locale.

  This method can only be called once.

  Parameters:
    `config` - a Settings implementation
  Throws:
    `java.lang.IllegalStateException` - if an error occurs when setting the settings implementation.

### getInstance

    public static org.apache.struts2.config.Settings getInstance()

  Deprecated.
  Provides the Settings object.

  This method will substitute the default instance if another instance is not registered.

  Returns:
    the Settings object.

### getLocale

    public static java.util.Locale getLocale()

  Deprecated.
  Provides the Struts default locale.

  This method utilizes the `struts.locale` setting, which should be given as the Java `toString()` representation of a Locale object ("en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC", and so forth).

  If a `struts.locale` setting is not registered, then the default virtual machine locale is substituted and cached.

  Returns:
    the Struts default locale if specified or the VM default locale.
  See Also:
    `Locale.getDefault()`

### isSet

    public static boolean isSet(java.lang.String name)

  Deprecated.
  Determines whether or not a setting has a registered value.

  This method is useful for testing for the existance of setting without throwing an IllegalArgumentException.

  Parameters:
    `name` - the name of a setting to test.
  Returns:
    `true` if the setting exists and has a value, `false` otherwise.

### get

    public static java.lang.String get(java.lang.String name)
                                throws java.lang.IllegalArgumentException

  Deprecated.
  Provides a setting value as a String.

  The method will throw an `IllegalArgumentException` if an error occurs while retrieveing the property or if the property doesn't exist.

  Parameters:
    `name` - the name of the setting to retrieve.
  Returns:
    the setting value as a String.
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs retrieving the property or the property does not exist.

### getLocation

    public static Location getLocation(java.lang.String name)
                                throws java.lang.IllegalArgumentException

  Deprecated.
  Provides the Location of a setting.

  The Location is utilized as part of precise error reporting.

  This method will throw an `IllegalArgumentException` if an error occurs while retrieving the value or if the setting doesn't exist.

  Parameters:
    `name` - the name of the property to get.
  Returns:
    the Location of a property.
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs retrieving the property or the property does not exist.

### list

    public static java.util.Iterator list()

  Deprecated.
  Provides an Iterator of all properties names.

  Returns:
    an Iterator of all properties names.

### set

    public static void set(java.lang.String name,
                           java.lang.String value)
                    throws java.lang.IllegalArgumentException,
                           java.lang.UnsupportedOperationException

  Deprecated.
  Registers a value for a setting.

  This method raises an exception if an error occurs when setting the value or if the settings implementation does not support setting values.

  Parameters:
    `name` - the name of the setting.
    `value` - the value to register for the setting.
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs when setting the value.
    `java.lang.UnsupportedOperationException` - if the config implementation does not support setting values.

### getLocationImpl

    public Location getLocationImpl(java.lang.String name)
                             throws java.lang.IllegalArgumentException

  Deprecated.
  Implements the `getLocation(String)` method.

  Parameters:
    `name` - Name of the setting to locate
  Returns:
    The location of the setting
  Throws:
    `java.lang.IllegalArgumentException` - if an error occurs when retrieving the value
  See Also:
    `getLocation(String)`

### reset

    public static void reset()

  Deprecated.
  Resets the default and any plugin Setting instance to null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.