public class DefaultSettings extends Object
This class creates and delegates to other settings by using an internal
DelegatingSettings
object.
Modifier and Type | Field and Description |
---|---|
protected Logger |
log
The logging instance for this class.
|
Constructor and Description |
---|
DefaultSettings()
Constructs an instance by loading the standard property files,
any custom property files (
struts.custom.properties ),
and any custom message resources (). |
Modifier and Type | Method and Description |
---|---|
static String |
get(String name)
Deprecated.
Provides a setting value as a String.
|
String |
getImpl(String aName)
Implements the
get(String) method. |
static org.apache.struts2.config.Settings |
getInstance()
Deprecated.
Provides the Settings object.
|
static Locale |
getLocale()
Deprecated.
Provides the Struts default locale.
|
static Location |
getLocation(String name)
Deprecated.
Provides the Location of a setting.
|
Location |
getLocationImpl(String name)
Deprecated.
Implements the
getLocation(String) method. |
static boolean |
isSet(String name)
Deprecated.
Determines whether or not a setting has a registered value.
|
boolean |
isSetImpl(String aName)
Implements the
isSet(String) method. |
static Iterator |
list()
Deprecated.
Provides an Iterator of all properties names.
|
Iterator |
listImpl()
Implements the
list() method. |
static void |
reset()
Deprecated.
Resets the default and any plugin Setting instance to null.
|
static void |
set(String name,
String value)
Deprecated.
Registers a value for a setting.
|
void |
setImpl(String name,
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.
|
protected Logger log
public DefaultSettings()
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.
public void setImpl(String name, String value) throws IllegalArgumentException, UnsupportedOperationException
set(String, String)
method.name
- Identifer for the setting to change.value
- The new value for the setting.IllegalArgumentException
- if an error occurs when setting the value.UnsupportedOperationException
- if the config implementation does not support setting values.set(String, String)
public String getImpl(String aName) throws IllegalArgumentException
get(String)
method.aName
- The name of the setting value to retreiveIllegalArgumentException
- if an error occurs when retrieving the valueget(String)
public boolean isSetImpl(String aName)
isSet(String)
method.aName
- Identifier for the setting value to changeisSet(String)
public Iterator listImpl()
list()
method.list()
public static void setInstance(org.apache.struts2.config.Settings config) throws IllegalStateException
This method can only be called once.
config
- a Settings implementationIllegalStateException
- if an error occurs when setting the settings implementation.public static org.apache.struts2.config.Settings getInstance()
This method will substitute the default instance if another instance is not registered.
public static Locale getLocale()
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.
Locale.getDefault()
public static boolean isSet(String name)
This method is useful for testing for the existance of setting without throwing an IllegalArgumentException.
name
- the name of a setting to test.true
if the setting exists and has a value, false
otherwise.public static String get(String name) throws IllegalArgumentException
The method will throw an IllegalArgumentException
if an error occurs
while retrieveing the property or if the property doesn't exist.
name
- the name of the setting to retrieve.IllegalArgumentException
- if an error occurs retrieving the property or the property does not exist.public static Location getLocation(String name) throws IllegalArgumentException
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.
name
- the name of the property to get.IllegalArgumentException
- if an error occurs retrieving the property or the property does not exist.public static Iterator list()
public static void set(String name, String value) throws IllegalArgumentException, UnsupportedOperationException
This method raises an exception if an error occurs when setting the value or if the settings implementation does not support setting values.
name
- the name of the setting.value
- the value to register for the setting.IllegalArgumentException
- if an error occurs when setting the value.UnsupportedOperationException
- if the config implementation does not support setting values.public Location getLocationImpl(String name) throws IllegalArgumentException
getLocation(String)
method.name
- Name of the setting to locateIllegalArgumentException
- if an error occurs when retrieving the valuegetLocation(String)
public static void reset()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.