org.formproc
Interface FormElement

All Known Implementing Classes:
AbstractFormElement

public interface FormElement

A FormElement represents a single form field. Each FormElement can have a FormValidator as well as zero or more user-readable messages and zero or more user-readable error messages. The FormElement interface provides a common interface which all FormElements must implement.

Author:
Anthony Eden

Method Summary
 java.lang.String getDefaultValue()
          Get the default value which is used if no data is submitted for the given form element.
 java.lang.String getMessage()
          Get the field's message in the default Locale.
 java.lang.String getMessage(java.util.Locale locale)
          Get the message in the given Locale.
 java.lang.String getName()
          Get the FormElement name.
 Storer getStorer()
          Get the Storer used to store field data in the target object.
 TypeConverter getTypeConverter()
          Get the TypeConverter which will be applied before invoking the target object's write method.
 Validator getValidator()
          Get the validator for this field.
 java.lang.String getWriteMethod()
          Get a predefined write method for the given form element.
 boolean isOptional()
          Return true if the FormElement is optional.
 void setDefaultValue(java.lang.String defaultValue)
          Set the default value which is used if no data is submitted for the given form element.
 void setOptional(boolean optional)
          Set to true if the FormElement is optional.
 void setOptional(java.lang.String optional)
          Set to "true" if the FormElement is optional.
 

Method Detail

getName

public java.lang.String getName()
Get the FormElement name.

Returns:
The name

getDefaultValue

public java.lang.String getDefaultValue()
Get the default value which is used if no data is submitted for the given form element. This method may return if no default value is specified.

Returns:
The default value or null

setDefaultValue

public void setDefaultValue(java.lang.String defaultValue)
Set the default value which is used if no data is submitted for the given form element. Set the value to null if no default value should be used.

Parameters:
defaultValue - The new default value

isOptional

public boolean isOptional()
Return true if the FormElement is optional. Optional form elements can have an empty value.

Returns:
True if the element is optional

setOptional

public void setOptional(boolean optional)
Set to true if the FormElement is optional.

Parameters:
optional - True if the element is optional

setOptional

public void setOptional(java.lang.String optional)
Set to "true" if the FormElement is optional.

Parameters:
optional - String "true" if element is optional

getMessage

public java.lang.String getMessage()
Get the field's message in the default Locale.

Returns:
The message

getMessage

public java.lang.String getMessage(java.util.Locale locale)
Get the message in the given Locale.

Parameters:
locale - The Locale
Returns:
The message

getWriteMethod

public java.lang.String getWriteMethod()
Get a predefined write method for the given form element. If the write method is not defined then this method returns null.

Returns:
The write method

getValidator

public Validator getValidator()
Get the validator for this field. This method may return null if no Validator is specified for this FormElement.

Returns:
The Validator or null

getTypeConverter

public TypeConverter getTypeConverter()
Get the TypeConverter which will be applied before invoking the target object's write method. This method may return null if no TypeConverter is specified for this FormElement.

Returns:
The TypeConverter or null

getStorer

public Storer getStorer()
Get the Storer used to store field data in the target object. This method may returbn null if no storer is specified for this FormElement.

Returns:
The Storer or null


Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.