|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.barracuda.core.forms.DefaultFormElement
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.
Note that the element keeps track of the original value as well, so that if for some reason you ever need to get to it that information is available.
Also not that we provide convenience methods which automatically cast for you (Note however: this type of thing is not type safe, meaning that you can get a ClassCastException if you do a getXXXVal() when the underlying object is not of type XXX.
Field Summary | |
protected boolean |
allowMultiples
|
protected java.lang.Object |
defaultVal
|
protected java.lang.String |
key
|
protected static org.apache.log4j.Logger |
logger
|
protected java.lang.String |
name
|
protected java.lang.Object |
origVal
|
protected ParseException |
pe
|
protected FormType |
type
|
protected java.lang.Object |
val
|
protected FormValidator |
validator
|
Constructor Summary | |
DefaultFormElement()
Public noargs constructor. |
|
DefaultFormElement(java.lang.String ikey)
Public constructor. |
|
DefaultFormElement(java.lang.String ikey,
FormType itype)
Public constructor. |
|
DefaultFormElement(java.lang.String ikey,
FormType itype,
java.lang.Object idefaultVal)
Public constructor. |
|
DefaultFormElement(java.lang.String ikey,
FormType itype,
java.lang.Object idefaultVal,
FormValidator ivalidator)
Public constructor. |
|
DefaultFormElement(java.lang.String ikey,
FormType itype,
java.lang.Object idefaultVal,
FormValidator ivalidator,
boolean iallowMultiples)
Public constructor, Name defaults to Key |
|
DefaultFormElement(java.lang.String ikey,
java.lang.String iname,
FormType itype,
java.lang.Object idefaultVal,
FormValidator ivalidator,
boolean iallowMultiples)
Public constructor |
Method Summary | |
boolean |
allowMultiples()
Does this element allow multiple values |
java.lang.Boolean |
getBooleanVal()
Get the value for this element as a Boolean |
java.lang.Boolean |
getBooleanVal(java.lang.Boolean dflt)
Get a Boolean value from the map, defaulting accordingly if the value is null |
java.util.Date |
getDateVal()
Get the value for this element as a Date |
java.util.Date |
getDateVal(java.util.Date dflt)
Get a Date value from the map, defaulting accordingly if the value is null |
java.lang.Object |
getDefaultVal()
Get the default value for this form element |
java.lang.Double |
getDoubleVal()
Get the value for this element as a Double |
java.lang.Double |
getDoubleVal(java.lang.Double dflt)
Get a Double value from the map, defaulting accordingly if the value is null |
java.lang.Float |
getFloatVal()
Get the value for this element as a Float |
java.lang.Float |
getFloatVal(java.lang.Float dflt)
Get a Float value from the map, defaulting accordingly if the value is null |
java.lang.Integer |
getIntegerVal()
Get the value for this element as a Integer |
java.lang.Integer |
getIntegerVal(java.lang.Integer dflt)
Get a Integer value from the map, defaulting accordingly if the value is null |
java.lang.String |
getKey()
Get the key value for this form element |
java.lang.Long |
getLongVal()
Get the value for this element as a Long |
java.lang.Long |
getLongVal(java.lang.Long dflt)
Get a Long value from the map, defaulting accordingly if the value is null |
java.lang.String |
getName()
Get the name of this form element |
java.lang.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) |
java.lang.Short |
getShortVal()
Get the value for this element as a Short |
java.lang.Short |
getShortVal(java.lang.Short dflt)
Get a Short value from the map, defaulting accordingly if the value is null |
java.lang.String |
getStringVal()
Get the value for this element as a String |
java.lang.String |
getStringVal(java.lang.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 |
java.lang.Object |
getVal()
Get the value for this element |
FormValidator |
getValidator()
Get the default FormValidator for this form element |
void |
setAllowMultiples(boolean val)
Set whether or not this element allows multiple values |
void |
setDefaultVal(java.lang.Object idefaultVal)
Set the default value for this form element |
void |
setKey(java.lang.String ikey)
Set the key value for this form element |
void |
setName(java.lang.String iname)
Set the name of this form element |
void |
setOrigVal(java.lang.Object iorigVal)
Set the original value for this element |
void |
setParseException(ParseException ipe)
Set the parse exception associated with this element |
void |
setType(FormType itype)
Set the FormType for this form element |
void |
setVal(java.lang.Object ival)
Set the value for this element |
void |
setValidator(FormValidator ivalidator)
Set the FormValidator for this form element |
java.lang.String |
toString()
Get a string representation of this element |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static org.apache.log4j.Logger logger
protected java.lang.String key
protected java.lang.String name
protected FormType type
protected java.lang.Object defaultVal
protected ParseException pe
protected FormValidator validator
protected boolean allowMultiples
protected java.lang.Object origVal
protected java.lang.Object val
Constructor Detail |
public DefaultFormElement()
public DefaultFormElement(java.lang.String ikey)
public DefaultFormElement(java.lang.String ikey, FormType itype)
public DefaultFormElement(java.lang.String ikey, FormType itype, java.lang.Object idefaultVal)
public DefaultFormElement(java.lang.String ikey, FormType itype, java.lang.Object idefaultVal, FormValidator ivalidator)
public DefaultFormElement(java.lang.String ikey, FormType itype, java.lang.Object idefaultVal, FormValidator ivalidator, boolean iallowMultiples)
public DefaultFormElement(java.lang.String ikey, java.lang.String iname, FormType itype, java.lang.Object idefaultVal, FormValidator ivalidator, boolean iallowMultiples)
Method Detail |
public void setKey(java.lang.String ikey)
setKey
in interface FormElement
ikey
- the key value for this form elementpublic java.lang.String getKey()
getKey
in interface FormElement
public void setName(java.lang.String iname)
setName
in interface FormElement
iname
- the name of this form elementpublic java.lang.String getName()
getName
in interface FormElement
public void setType(FormType itype)
setType
in interface FormElement
itype
- the FormType for this form elementpublic FormType getType()
getType
in interface FormElement
public void setDefaultVal(java.lang.Object idefaultVal)
setDefaultVal
in interface FormElement
idefaultVal
- the FormType for this form elementpublic java.lang.Object getDefaultVal()
getDefaultVal
in interface FormElement
public void setAllowMultiples(boolean val)
setAllowMultiples
in interface FormElement
val
- true if the element allows multiplespublic boolean allowMultiples()
allowMultiples
in interface FormElement
public void setValidator(FormValidator ivalidator)
setValidator
in interface FormElement
ivalidator
- the FormValidator for this form elementpublic FormValidator getValidator()
getValidator
in interface FormElement
public void setOrigVal(java.lang.Object iorigVal)
setOrigVal
in interface FormElement
public java.lang.Object getOrigVal()
getOrigVal
in interface FormElement
public void setVal(java.lang.Object ival)
setVal
in interface FormElement
public java.lang.Object getVal()
getVal
in interface FormElement
public void setParseException(ParseException ipe)
setParseException
in interface FormElement
public ParseException getParseException()
getParseException
in interface FormElement
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getStringVal()
public java.lang.String getStringVal(java.lang.String dflt)
public java.lang.Boolean getBooleanVal()
public java.lang.Boolean getBooleanVal(java.lang.Boolean dflt)
public java.lang.Integer getIntegerVal()
public java.lang.Integer getIntegerVal(java.lang.Integer dflt)
public java.util.Date getDateVal()
public java.util.Date getDateVal(java.util.Date dflt)
public java.lang.Long getLongVal()
public java.lang.Long getLongVal(java.lang.Long dflt)
public java.lang.Short getShortVal()
public java.lang.Short getShortVal(java.lang.Short dflt)
public java.lang.Double getDoubleVal()
public java.lang.Double getDoubleVal(java.lang.Double dflt)
public java.lang.Float getFloatVal()
public java.lang.Float getFloatVal(java.lang.Float dflt)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |