Class FormPropertyConfig
- All Implemented Interfaces:
Serializable
A JavaBean representing the configuration information of a
<form-property> element in a Struts configuration
file.
- Since:
- Struts 1.1
- Version:
- $Rev$ $Date: 2005-11-12 11:52:08 -0500 (Sat, 12 Nov 2005)$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringString representation of the initial value for this property.protected StringThe JavaBean property name of the property described by this element.protected StringThe conditions under which the property described by this element should be reset to itsinitialvalue when the form'sresetmethod is called.protected intThe size of the array to be created if this property is an array type and there is no specifiedinitialvalue.protected StringThe fully qualified Java class name of the implementation class of this bean property, optionally followed by[]to indicate that the property is indexed.Fields inherited from class org.apache.struts.config.BaseConfig
configured -
Constructor Summary
ConstructorsConstructorDescriptionStandard no-arguments constructor for dynamic instantiation.FormPropertyConfig(String name, String type, String initial) Constructor that preconfigures the relevant properties.FormPropertyConfig(String name, String type, String initial, int size) Constructor that preconfigures the relevant properties.FormPropertyConfig(String name, String type, String initial, String reset) Constructor that preconfigures the relevant properties.FormPropertyConfig(String name, String type, String initial, String reset, int size) Constructor that preconfigures the relevant properties. -
Method Summary
Modifier and TypeMethodDescriptiongetName()getReset()intgetSize()getType()Class<?> Return a Class corresponds to the value specified for thetypeproperty, taking into account the trailing "[]" for arrays (as well as the ability to specify primitive Java types).voidinheritFrom(FormPropertyConfig config) Inherit values that have not been overridden from the provided config object.initial()Return an object representing the initial value of this property.voidsetInitial(String initial) voidvoidvoidsetSize(int size) voidtoString()Return a String representation of this object.Methods inherited from class org.apache.struts.config.BaseConfig
copyProperties, freeze, getProperties, getProperty, inheritProperties, setProperties, setProperty, throwIfConfigured
-
Field Details
-
initial
String representation of the initial value for this property. -
name
The JavaBean property name of the property described by this element. -
reset
The conditions under which the property described by this element should be reset to its
initialvalue when the form'sresetmethod is called.This may be set to true (to always reset the property) or a comma-separated list of HTTP request methods.
- Since:
- Struts 1.3
-
size
protected int sizeThe size of the array to be created if this property is an array type and there is no specified
initialvalue. This value must be non-negative.- Since:
- Struts 1.1
-
type
The fully qualified Java class name of the implementation class of this bean property, optionally followed by[]to indicate that the property is indexed.
-
-
Constructor Details
-
FormPropertyConfig
public FormPropertyConfig()Standard no-arguments constructor for dynamic instantiation. -
FormPropertyConfig
Constructor that preconfigures the relevant properties.- Parameters:
name- Name of this propertytype- Fully qualified class name of this propertyinitial- Initial value of this property (if any)
-
FormPropertyConfig
Constructor that preconfigures the relevant properties.- Parameters:
name- Name of this propertytype- Fully qualified class name of this propertyinitial- Initial value of this property (if any)reset- The conditions under which this property will be reset to its initial value.
-
FormPropertyConfig
Constructor that preconfigures the relevant properties.- Parameters:
name- Name of this propertytype- Fully qualified class name of this propertyinitial- Initial value of this property (if any)size- Size of the array to be created if this property is an array with no defined initial value
-
FormPropertyConfig
Constructor that preconfigures the relevant properties.- Parameters:
name- Name of this propertytype- Fully qualified class name of this propertyinitial- Initial value of this property (if any)reset- The conditions under which this property will be reset to its initial value.size- Size of the array to be created if this property is an array with no defined initial value
-
-
Method Details
-
getInitial
-
setInitial
-
getName
-
setName
-
getReset
-
setReset
-
getSize
public int getSize() -
setSize
public void setSize(int size) -
getType
-
setType
-
getTypeClass
Return a Class corresponds to the value specified for thetypeproperty, taking into account the trailing "[]" for arrays (as well as the ability to specify primitive Java types). -
initial
Return an object representing the initial value of this property. This is calculated according to the following algorithm:
- If the value you have specified for the
typeproperty represents an array (i.e. it ends with "[]"):- If you have specified a value for the
initialproperty,ConvertUtils.convertwill be called to convert it into an instance of the specified array type. - If you have not specified a value for the
initialproperty, an array of the length specified by thesizeproperty will be created. Each element of the array will be instantiated via the zero-args constructor on the specified class (if any). Otherwise,nullwill be returned.
- If you have specified a value for the
- If the value you have specified for the
typeproperty does not represent an array:- If you have specified a value for the
initialproperty,ConvertUtils.convertwill be called to convert it into an object instance. - If you have not specified a value for the
initialattribute, Struts will instantiate an instance via the zero-args constructor on the specified class (if any). Otherwise,nullwill be returned.
- If you have specified a value for the
- If the value you have specified for the
-
inheritFrom
public void inheritFrom(FormPropertyConfig config) throws IllegalAccessException, InvocationTargetException, InstantiationException, ClassNotFoundException 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 MyCustomFormPropertyConfig) { MyCustomFormPropertyConfig myConfig = (MyCustomFormPropertyConfig) config; if (getMyCustomProp() == null) { setMyCustomProp(myConfig.getMyCustomProp()); } }- Parameters:
config- The object that this instance will be inheriting its values from.- Throws:
IllegalAccessExceptionInvocationTargetExceptionInstantiationExceptionClassNotFoundException
-
toString
Return a String representation of this object.
-