org.apache.struts.config

Class FormPropertyConfig

Implemented Interfaces:
Serializable

public class FormPropertyConfig
extends java.lang.Object
implements Serializable

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

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

Field Summary

protected boolean
configured
Has this component been completely configured?
protected String
initial
String representation of the initial value for this property.
private static Log
log
The logging instance
protected String
name
The JavaBean property name of the property described by this element.
protected int
size
The size of the array to be created if this property is an array type and there is no specified initial value.
protected String
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 Summary

FormPropertyConfig()
Standard 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.

Method Summary

void
freeze()
Freeze the configuration of this component.
String
getInitial()
String
getName()
int
getSize()
String
getType()
Class
getTypeClass()
Return a Class corresponds to the value specified for the type property, taking into account the trailing "[]" for arrays (as well as the ability to specify primitive Java types).
Object
initial()
Return an object representing the initial value of this property.
void
setInitial(String initial)
void
setName(String name)
void
setSize(int size)
void
setType(String type)
String
toString()
Return a String representation of this object.

Field Details

configured

protected boolean configured
Has this component been completely configured?

initial

protected String initial
String representation of the initial value for this property.

log

private static final Log log
The logging instance

name

protected String name
The JavaBean property name of the property described by this element.

size

protected int size
The size of the array to be created if this property is an array type and there is no specified initial value. This value must be non-negative.
Since:
Struts 1.1

type

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

public FormPropertyConfig(String name,
                          String type,
                          String initial)
Constructor that preconfigures the relevant properties.
Parameters:
name - Name of this property
type - Fully qualified class name of this property
initial - Initial value of this property (if any)

FormPropertyConfig

public FormPropertyConfig(String name,
                          String type,
                          String initial,
                          int size)
Constructor that preconfigures the relevant properties.
Parameters:
name - Name of this property
type - Fully qualified class name of this property
initial - 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

Method Details

freeze

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

getInitial

public String getInitial()

getName

public String getName()

getSize

public int getSize()

getType

public String getType()

getTypeClass

public Class getTypeClass()
Return a Class corresponds to the value specified for the type property, taking into account the trailing "[]" for arrays (as well as the ability to specify primitive Java types).

initial

public Object 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 type property represents an array (i.e. it ends with "[]"):
    • If you have specified a value for the initial property, ConvertUtils.convert will be called to convert it into an instance of the specified array type.
    • If you have not specified a value for the initial property, an array of the length specified by the size property will be created. Each element of the array will be instantiated via the zero-args constructor on the specified class (if any). Otherwise, null will be returned.
  • If the value you have specified for the type property does not represent an array:
    • If you have specified a value for the initial property, ConvertUtils.convert will be called to convert it into an object instance.
    • If you have not specified a value for the initial attribute, Struts will instantiate an instance via the zero-args constructor on the specified class (if any). Otherwise, null will be returned.

  • setInitial

    public void setInitial(String initial)

    setName

    public void setName(String name)

    setSize

    public void setSize(int size)

    setType

    public void setType(String type)

    toString

    public String toString()
    Return a String representation of this object.

    Copyright B) 2000-2007 - The Apache Software Foundation