org.enhydra.barracuda.core.forms
Interface FormElement

All Known Implementing Classes:
DefaultFormElement

public interface FormElement

This interfaces defines the methods a class needs to implement to act as a FormElement.

A FormElement defines how an element in a FormMap should be mapped to a first class java object. There are several key pieces of information required:

Once we have this information, we basically have enough data to map a String value in the data source to a first class Java object in the element.


Method Summary
 boolean allowMultiples()
          Does this element allow multiple values
 Boolean getBooleanVal()
          Get the value for this element as a Boolean
 Boolean getBooleanVal(Boolean dflt)
          Get a Boolean value from the map, defaulting accordingly if the value is null
 Date getDateVal()
          Get the value for this element as a Date
 Date getDateVal(Date dflt)
          Get a Date value from the map, defaulting accordingly if the value is null
 Object getDefaultVal()
          Get the default value for this form element
 Double getDoubleVal()
          Get the value for this element as a Double
 Double getDoubleVal(Double dflt)
          Get a Double value from the map, defaulting accordingly if the value is null
 Float getFloatVal()
          Get the value for this element as a Float
 Float getFloatVal(Float dflt)
          Get a Float value from the map, defaulting accordingly if the value is null
 Integer getIntegerVal()
          Get the value for this element as a Integer
 Integer getIntegerVal(Integer dflt)
          Get a Integer value from the map, defaulting accordingly if the value is null
 String getKey()
          Get the key value for this form element
 Long getLongVal()
          Get the value for this element as a Long
 Long getLongVal(Long dflt)
          Get a Long value from the map, defaulting accordingly if the value is null
 String getName()
          Get the name value of form element
 Object getOrigVal()
          Get the original value for this element
 ParseException getParseException()
          Get any parse exceptions associated with the element (ie. that might have occurred when the element was mapped)
 Short getShortVal()
          Get the value for this element as a Short
 Short getShortVal(Short dflt)
          Get a Short value from the map, defaulting accordingly if the value is null
 String getStringVal()
          Get the value for this element as a String
 String getStringVal(String dflt)
          Get the value for this element as a String, defaulting accordingly if the value is null
 FormType getType()
          Get the FormType for this for element
 Object getVal()
          Get the value for this element.
 FormValidator getValidator()
          Get the default FormValidator for this form element
 Object[] getVals()
          Get all the values for this element.
 void setAllowMultiples(boolean val)
          Set whether or not this element allows multiple values
 void setDefaultVal(Object defaultVal)
          Set the default value for this form element
 void setKey(String key)
          Set the key value for this form element
 void setName(String name)
          Set the name of this form element
 void setOrigVal(Object iorigVal)
          Set the original value for this element
 void setParseException(ParseException pe)
          Set the parse exception associated with this element
 void setType(FormType type)
          Set the FormType for this form element
 void setVal(Object ival)
          Set the value for this element
 void setValidator(FormValidator validator)
          Set the FormValidator for this form element
 

Method Detail

setKey

public void setKey(String key)
Set the key value for this form element

Parameters:
key - the key value for this form element

getKey

public String getKey()
Get the key value for this form element

Returns:
the key for this form element

setName

public void setName(String name)
Set the name of this form element

Parameters:
name - the name value of this form element

getName

public String getName()
Get the name value of form element

Returns:
the name of this form element

setType

public void setType(FormType type)
Set the FormType for this form element

Parameters:
type - the FormType for this form element

getType

public FormType getType()
Get the FormType for this for element

Returns:
the FormType for this form element

setDefaultVal

public void setDefaultVal(Object defaultVal)
Set the default value for this form element

Parameters:
defaultVal - the FormType for this form element

getDefaultVal

public Object getDefaultVal()
Get the default value for this form element

Returns:
the default value for this form element (may be null)

setAllowMultiples

public void setAllowMultiples(boolean val)
Set whether or not this element allows multiple values

Parameters:
val - true if the element allows multiples

allowMultiples

public boolean allowMultiples()
Does this element allow multiple values

Returns:
true if this element allows multiple values

setValidator

public void setValidator(FormValidator validator)
Set the FormValidator for this form element

Parameters:
validator - the FormValidator for this form element

getValidator

public FormValidator getValidator()
Get the default FormValidator for this form element

Returns:
the validator for this form element (may be null)

setOrigVal

public void setOrigVal(Object iorigVal)
Set the original value for this element

Parameters:
iorigVal - the original value

getOrigVal

public Object getOrigVal()
Get the original value for this element

Returns:
the original value for this form element (may be null)

setVal

public void setVal(Object ival)
Set the value for this element

Parameters:
ival - the value for this element

getVal

public Object getVal()
Get the value for this element. If the underlying object is actually an array (ie. allowMultiples = true), then you should really be calling getVals() to get the whole object array; if you call this method, you will just get the first element of the array.

Returns:
the value for this form element (may be null)

getVals

public Object[] getVals()
Get all the values for this element. There will always be an array returned. if the value for this FormElement is null, an empty array is returned. This method only really makes sense if allowMultiples = true

Returns:
the array of values for this form element

getStringVal

public String getStringVal()
Get the value for this element as a String


getStringVal

public String getStringVal(String dflt)
Get the value for this element as a String, defaulting accordingly if the value is null


getBooleanVal

public Boolean getBooleanVal()
Get the value for this element as a Boolean


getBooleanVal

public Boolean getBooleanVal(Boolean dflt)
Get a Boolean value from the map, defaulting accordingly if the value is null


getIntegerVal

public Integer getIntegerVal()
Get the value for this element as a Integer


getIntegerVal

public Integer getIntegerVal(Integer dflt)
Get a Integer value from the map, defaulting accordingly if the value is null


getDateVal

public Date getDateVal()
Get the value for this element as a Date


getDateVal

public Date getDateVal(Date dflt)
Get a Date value from the map, defaulting accordingly if the value is null


getLongVal

public Long getLongVal()
Get the value for this element as a Long


getLongVal

public Long getLongVal(Long dflt)
Get a Long value from the map, defaulting accordingly if the value is null


getShortVal

public Short getShortVal()
Get the value for this element as a Short


getShortVal

public Short getShortVal(Short dflt)
Get a Short value from the map, defaulting accordingly if the value is null


getDoubleVal

public Double getDoubleVal()
Get the value for this element as a Double


getDoubleVal

public Double getDoubleVal(Double dflt)
Get a Double value from the map, defaulting accordingly if the value is null


getFloatVal

public Float getFloatVal()
Get the value for this element as a Float


getFloatVal

public Float getFloatVal(Float dflt)
Get a Float value from the map, defaulting accordingly if the value is null


setParseException

public void setParseException(ParseException pe)
Set the parse exception associated with this element

Returns:
any parse exceptions associated with the element

getParseException

public ParseException getParseException()
Get any parse exceptions associated with the element (ie. that might have occurred when the element was mapped)

Returns:
any parse exceptions associated with the element


Copyright © 2003 BarracudaMVC.org All Rights Reserved.