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
Modifier and TypeFieldDescriptionprotected boolean
Indicates if configuration of this component been completed. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Properties
Return a copy of the properties held by this object.void
freeze()
Freeze the configuration of this action.protected Properties
Return 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 void
inheritProperties
(BaseConfig baseConfig) Compare the properties of this config with that of the given and copy those that are not present.protected void
setProperties
(Properties properties) Set the entire set of properties configured for this object.void
setProperty
(String key, String value) Set an arbitary key/value pair which can be retrieved by this config class.void
ThrowIllegalStateException
if 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()ThrowIllegalStateException
if 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*Config
classes by providing a mechanism to pass any amount of arbitrary configuration information into an config class.IllegalStateException
will 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-config
file- 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.
-