|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.config.BaseConfig org.apache.struts.config.FormBeanConfig
public class FormBeanConfig
A JavaBean representing the configuration information of a
<form-bean>
element in a Struts configuration file.
Field Summary | |
---|---|
protected DynaActionFormClass |
dynaActionFormClass
The DynaActionFormClass associated with a DynaActionForm. |
protected boolean |
dynamic
Is the form bean class an instance of DynaActionForm with dynamic properties? |
protected boolean |
extensionProcessed
Have the inheritance values for this class been applied? |
protected java.util.HashMap |
formProperties
The set of FormProperty elements defining dynamic form properties for this form bean, keyed by property name. |
protected java.lang.String |
inherit
The name of the FormBeanConfig that this config inherits configuration information from. |
protected java.lang.String |
lock
The lockable object we can synchronize on when creating DynaActionFormClass. |
protected java.lang.String |
name
The unique identifier of this form bean, which is used to reference this bean in ActionMapping instances as well as for the
name of the request or session attribute under which the corresponding
form bean instance is created or accessed. |
protected boolean |
restricted
Is this DynaClass currently restricted (for DynaBeans with a MutableDynaClass). |
protected java.lang.String |
type
The fully qualified Java class name of the implementation class to be used or generated. |
Fields inherited from class org.apache.struts.config.BaseConfig |
---|
configured |
Constructor Summary | |
---|---|
FormBeanConfig()
|
Method Summary | |
---|---|
void |
addFormPropertyConfig(FormPropertyConfig config)
Add a new FormPropertyConfig instance to the set
associated with this module. |
boolean |
canReuse(ActionForm form)
Checks if the given ActionForm instance is suitable for
use as an alternative to calling this FormBeanConfig
instance's createActionForm method. |
protected boolean |
checkCircularInheritance(ModuleConfig moduleConfig)
Traces the hierarchy of this object to check if any of the ancestors is extending this instance. |
ActionForm |
createActionForm(ActionContext context)
Create and return an ActionForm instance appropriate to
the information in this FormBeanConfig . |
ActionForm |
createActionForm(ActionServlet servlet)
Create and return an ActionForm instance appropriate to
the information in this FormBeanConfig . |
FormPropertyConfig |
findFormPropertyConfig(java.lang.String name)
Return the form property configuration for the specified property name, if any; otherwise return null . |
FormPropertyConfig[] |
findFormPropertyConfigs()
Return the form property configurations for this module. |
protected java.lang.Class |
formBeanClass()
Return the Class instance for the form bean implementation
configured by this FormBeanConfig instance. |
void |
freeze()
Freeze the configuration of this component. |
DynaActionFormClass |
getDynaActionFormClass()
Return the DynaActionFormClass associated with a DynaActionForm. |
boolean |
getDynamic()
|
java.lang.String |
getExtends()
|
java.lang.String |
getName()
|
java.lang.String |
getType()
|
protected void |
inheritFormProperties(FormBeanConfig config)
Compare the form properties of this bean with that of the given and copy those that are not present. |
void |
inheritFrom(FormBeanConfig config)
Inherit values that have not been overridden from the provided config object. |
boolean |
isExtensionProcessed()
|
boolean |
isRestricted()
Indicates whether a MutableDynaClass is currently restricted. |
void |
processExtends(ModuleConfig moduleConfig)
Inherit configuration information from the FormBeanConfig that this instance is extending. |
void |
removeFormPropertyConfig(FormPropertyConfig config)
Remove the specified form property configuration instance. |
void |
setExtends(java.lang.String extend)
|
void |
setName(java.lang.String name)
|
void |
setRestricted(boolean restricted)
Set whether a MutableDynaClass is currently restricted. |
void |
setType(java.lang.String type)
|
java.lang.String |
toString()
Return a String representation of this object. |
Methods inherited from class org.apache.struts.config.BaseConfig |
---|
copyProperties, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap formProperties
protected java.lang.String lock
The lockable object we can synchronize on when creating DynaActionFormClass.
protected transient DynaActionFormClass dynaActionFormClass
protected boolean dynamic
protected java.lang.String inherit
protected boolean extensionProcessed
protected java.lang.String name
ActionMapping
instances as well as for the
name of the request or session attribute under which the corresponding
form bean instance is created or accessed.
protected java.lang.String type
protected boolean restricted
Constructor Detail |
---|
public FormBeanConfig()
Method Detail |
---|
public DynaActionFormClass getDynaActionFormClass()
Return the DynaActionFormClass associated with a DynaActionForm.
java.lang.IllegalArgumentException
- if the ActionForm is not dynamicpublic boolean getDynamic()
public java.lang.String getExtends()
public void setExtends(java.lang.String extend)
public boolean isExtensionProcessed()
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getType()
public void setType(java.lang.String type)
public boolean isRestricted()
Indicates whether a MutableDynaClass is currently restricted.
If so, no changes to the existing registration of property names, data types, readability, or writeability are allowed.
public void setRestricted(boolean restricted)
Set whether a MutableDynaClass is currently restricted.
If so, no changes to the existing registration of property names, data types, readability, or writeability are allowed.
protected boolean checkCircularInheritance(ModuleConfig moduleConfig)
Traces the hierarchy of this object to check if any of the ancestors is extending this instance.
moduleConfig
- The configuration for the module being configured.
protected void inheritFormProperties(FormBeanConfig config) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
Compare the form properties of this bean with that of the given and copy those that are not present.
config
- The form bean config to copy properties from.
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
inheritFrom(FormBeanConfig)
public ActionForm createActionForm(ActionServlet servlet) throws java.lang.IllegalAccessException, java.lang.InstantiationException
Create and return an ActionForm
instance appropriate to
the information in this FormBeanConfig
.
Although this method is not formally deprecated yet, where possible,
the form which accepts an ActionContext
as an argument is
preferred, to help sever direct dependencies on the Servlet API. As
the ActionContext becomes more familiar in Struts, this method will
almost certainly be deprecated.
servlet
- The action servlet
java.lang.IllegalAccessException
- if the Class or the appropriate
constructor is not accessible
java.lang.InstantiationException
- if this Class represents an abstract
class, an array class, a primitive type,
or void; or if instantiation fails for
some other reasonpublic ActionForm createActionForm(ActionContext context) throws java.lang.IllegalAccessException, java.lang.InstantiationException
Create and return an ActionForm
instance appropriate to
the information in this FormBeanConfig
.
NOTE: If the given ActionContext
is not of type
ServletActionContext
(or a subclass), then the form which
is returned will have a null servlet
property. Some of
the subclasses of ActionForm
included in Struts will later
throw a NullPointerException
in this case.
TODO: Find a way to control this direct dependency on the Servlet API.
context
- The ActionContext.
java.lang.IllegalAccessException
- if the Class or the appropriate
constructor is not accessible
java.lang.InstantiationException
- if this Class represents an abstract
class, an array class, a primitive type,
or void; or if instantiation fails for
some other reasonpublic boolean canReuse(ActionForm form)
Checks if the given ActionForm
instance is suitable for
use as an alternative to calling this FormBeanConfig
instance's createActionForm
method.
form
- an existing form instance that may be reused.
public void addFormPropertyConfig(FormPropertyConfig config)
FormPropertyConfig
instance to the set
associated with this module.
config
- The new configuration instance to be added
java.lang.IllegalArgumentException
- if this property name has already been
definedpublic FormPropertyConfig findFormPropertyConfig(java.lang.String name)
null
.
name
- Form property name to find a configuration forpublic FormPropertyConfig[] findFormPropertyConfigs()
public void freeze()
freeze
in class BaseConfig
public void inheritFrom(FormBeanConfig config) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
Inherit values that have not been overridden from the provided config object. Subclasses overriding this method should verify that the given parameter is of a class that contains a property it is trying to inherit:
if (config instanceof MyCustomConfig) { MyCustomConfig myConfig = (MyCustomConfig) config; if (getMyCustomProp() == null) { setMyCustomProp(myConfig.getMyCustomProp()); } }
If the given config
is extending another object, those
extensions should be resolved before it's used as a parameter to this
method.
config
- The object that this instance will be inheriting its
values from.
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
processExtends(ModuleConfig)
public void processExtends(ModuleConfig moduleConfig) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException
Inherit configuration information from the FormBeanConfig that this instance is extending. This method verifies that any form bean config object that it inherits from has also had its processExtends() method called.
moduleConfig
- The ModuleConfig
that this bean is from.
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
inheritFrom(FormBeanConfig)
public void removeFormPropertyConfig(FormPropertyConfig config)
config
- FormPropertyConfig instance to be removedpublic java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.Class formBeanClass()
Class
instance for the form bean implementation
configured by this FormBeanConfig
instance. This method
uses the same algorithm as RequestUtils.applicationClass()
but is reproduced to avoid a runtime dependence.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |