org.apache.struts.config

Class FormBeanConfig

public class FormBeanConfig extends Object implements Serializable

A JavaBean representing the configuration information of a <form-bean> element in a Struts configuration file.

Since: Struts 1.1

Version: $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $

Field Summary
protected booleanconfigured
Has this component been completely configured?
protected DynaActionFormClassdynaActionFormClass
The DynaActionFormClass associated with a DynaActionForm.
protected booleandynamic
Is the form bean class an instance of DynaActionForm with dynamic properties?
protected HashMapformProperties
The set of FormProperty elements defining dynamic form properties for this form bean, keyed by property name.
protected Stringlock

The lockable object we can synchronize on when creating DynaActionFormClass.

protected Stringname
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 booleanrestricted
Is this DynaClass currently restricted (for DynaBeans with a MutableDynaClass).
protected Stringtype
The fully qualified Java class name of the implementation class to be used or generated.
Method Summary
voidaddFormPropertyConfig(FormPropertyConfig config)
Add a new FormPropertyConfig instance to the set associated with this module.
ActionFormcreateActionForm(ActionServlet servlet)

Create and return an ActionForm instance appropriate to the information in this FormBeanConfig.

FormPropertyConfigfindFormPropertyConfig(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 ClassformBeanClass()
Return the Class instance for the form bean implementation configured by this FormBeanConfig instance.
voidfreeze()
Freeze the configuration of this component.
DynaActionFormClassgetDynaActionFormClass()

Return the DynaActionFormClass associated with a DynaActionForm.

booleangetDynamic()
StringgetName()
StringgetType()
booleanisRestricted()

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.

voidremoveFormPropertyConfig(FormPropertyConfig config)
Remove the specified form property configuration instance.
voidsetDynamic(boolean dynamic)
voidsetName(String name)
voidsetRestricted(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.

voidsetType(String type)
StringtoString()
Return a String representation of this object.

Field Detail

configured

protected boolean configured
Has this component been completely configured?

dynaActionFormClass

protected transient DynaActionFormClass dynaActionFormClass
The DynaActionFormClass associated with a DynaActionForm.

dynamic

protected boolean dynamic
Is the form bean class an instance of DynaActionForm with dynamic properties?

formProperties

protected HashMap formProperties
The set of FormProperty elements defining dynamic form properties for this form bean, keyed by property name.

lock

protected String lock

The lockable object we can synchronize on when creating DynaActionFormClass.

name

protected 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.

restricted

protected boolean restricted
Is this DynaClass currently restricted (for DynaBeans with a MutableDynaClass).

type

protected String type
The fully qualified Java class name of the implementation class to be used or generated.

Method Detail

addFormPropertyConfig

public void addFormPropertyConfig(FormPropertyConfig config)
Add a new FormPropertyConfig instance to the set associated with this module.

Parameters: config The new configuration instance to be added

Throws: IllegalArgumentException if this property name has already been defined

createActionForm

public ActionForm createActionForm(ActionServlet servlet)

Create and return an ActionForm instance appropriate to the information in this FormBeanConfig.

Parameters: servlet The action servlet

Returns: ActionForm instance

Throws: IllegalAccessException if the Class or the appropriate constructor is not accessible InstantiationException if this Class represents an abstract class, an array class, a primitive type, or void; or if instantiation fails for some other reason

findFormPropertyConfig

public FormPropertyConfig findFormPropertyConfig(String name)
Return the form property configuration for the specified property name, if any; otherwise return null.

Parameters: name Form property name to find a configuration for

findFormPropertyConfigs

public FormPropertyConfig[] findFormPropertyConfigs()
Return the form property configurations for this module. If there are none, a zero-length array is returned.

formBeanClass

protected Class formBeanClass()
Return the 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.

freeze

public void freeze()
Freeze the configuration of this component.

getDynaActionFormClass

public DynaActionFormClass getDynaActionFormClass()

Return the DynaActionFormClass associated with a DynaActionForm.

Throws: IllegalArgumentException if the ActionForm is not dynamic

getDynamic

public boolean getDynamic()

getName

public String getName()

getType

public String getType()

isRestricted

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.

removeFormPropertyConfig

public void removeFormPropertyConfig(FormPropertyConfig config)
Remove the specified form property configuration instance.

Parameters: config FormPropertyConfig instance to be removed

setDynamic

public void setDynamic(boolean dynamic)

Deprecated: The value to be returned by getDynamic() is now computed automatically in setType()

setName

public void setName(String name)

setRestricted

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.

setType

public void setType(String type)

toString

public String toString()
Return a String representation of this object.
Copyright B) 2000-2009 - The Apache Software Foundation