Class BaseConfig
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ActionConfig,ControllerConfig,ExceptionConfig,FormBeanConfig,FormPropertyConfig,ForwardConfig,MessageResourcesConfig,ModuleConfigImpl
A abstract base class for all config classes. Provide basic support for arbitrary properties
- Since:
- Struts 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates if configuration of this component been completed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertiesReturn a copy of the properties held by this object.voidfreeze()Freeze the configuration of this action.protected PropertiesReturn the entire set of properties configured for this object.getProperty(String key) Return the property-value for the specified key, if any; otherwise returnnull.protected voidinheritProperties(BaseConfig baseConfig) Compare the properties of this config with that of the given and copy those that are not present.protected voidsetProperties(Properties properties) Set the entire set of properties configured for this object.voidsetProperty(String key, String value) Set an arbitary key/value pair which can be retrieved by this config class.voidThrowIllegalStateExceptionif configuration is frozen.
-
Field Details
-
configured
protected boolean configuredIndicates if configuration of this component been completed. TODO change protected to private and use methods provided by extenders?
-
-
Constructor Details
-
BaseConfig
public BaseConfig()
-
-
Method Details
-
freeze
public void freeze()Freeze the configuration of this action. -
throwIfConfigured
public void throwIfConfigured()ThrowIllegalStateExceptionif configuration is frozen.- Throws:
IllegalStateException- if configuration is frozen
-
setProperty
Set an arbitary key/value pair which can be retrieved by this config class. This facility should eliminate many use cases for subclassing
This method must not be called after configuration is complete, or an*Configclasses by providing a mechanism to pass any amount of arbitrary configuration information into an config class.IllegalStateExceptionwill be thrown.Example
<action path="/example" type="com.example.MyAction"> <set-property key="foo" property="bar" /> </action>- Parameters:
key- the key by which this value will be retrievedvalue- the value to store with the supplied key- Throws:
IllegalStateException- if this module configuration has been frozen- Since:
- Struts 1.3
-
getProperty
Return the property-value for the specified key, if any; otherwise returnnull.- Parameters:
key- a key specified in thestruts-configfile- Returns:
- the value stored with the supplied key
- Since:
- Struts 1.3
-
getProperties
Return the entire set of properties configured for this object. At this time, this only needs to be exposed to support inheritance, so choosing a conservative access modifier ("protected").
- Returns:
- set of properties configured for this object
-
setProperties
Set the entire set of properties configured for this object. At this time, this only needs to be exposed to support inheritance, so choosing a conservative access modifier ("protected"). -
inheritProperties
Compare the properties of this config with that of the given and copy those that are not present. This method is used by subclasses that support configuration inheritance.
- Parameters:
baseConfig- The config object to copy properties from.
-
copyProperties
Return a copy of the properties held by this object.
-