|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object toolbox.web.validation.AbstractField
public abstract class AbstractField
Abstract partial field implementation to provide a convenience base class for implementing fields.
Provide implementations of all Field methods except validate.
Constructor Summary | |
---|---|
AbstractField()
Protected constructor |
Method Summary | |
---|---|
java.lang.String |
getDefault()
Return the string representation of the default value of this field. |
java.lang.String |
getName()
Return the name of this field. |
java.util.regex.Pattern |
getPattern()
Return the pattern used to identify this field. |
java.util.Properties |
getProperties()
Return all the field specific properties. |
java.lang.String |
getProperty(java.lang.String name)
Return a field specific property. |
java.lang.String |
getResourceKey()
Return the resource key used to lookup the display value of this field. |
protected java.lang.String |
getResourceString(java.lang.String key,
java.lang.Object[] args,
java.util.ResourceBundle bundle)
Return a resource string by formatting the resource string using the provided parameters. |
protected java.lang.String |
getResourceString(java.lang.String key,
java.util.ResourceBundle bundle)
Return a resource string from the given bundle |
boolean |
isRequired()
Indicates whether this field is required or not. |
void |
setDefault(java.lang.String def)
Set the string representation of the default value of this field. |
void |
setName(java.lang.String name)
Set the name of this field. |
void |
setPattern(java.util.regex.Pattern pattern)
Set the pattern used to identify this field. |
void |
setProperties(java.util.Properties props)
Set any field specific properties. |
void |
setRequired(java.lang.Boolean required)
Set the required flag of this field. |
void |
setResourceKey(java.lang.String key)
Set the value of the resource key used to look up the display value of this field. |
protected java.lang.String |
validateRequired(java.lang.String value,
java.util.ResourceBundle bundle)
Convenience method to perform the "required" validation test. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface toolbox.web.validation.Field |
---|
validate |
Constructor Detail |
---|
public AbstractField()
Method Detail |
---|
public java.lang.String getName()
getName
in interface Field
public void setName(java.lang.String name)
setName
in interface Field
name
- String indicating the name of this field.public java.lang.String getResourceKey()
getResourceKey
in interface Field
public void setResourceKey(java.lang.String key)
setResourceKey
in interface Field
key
- String containing resource key.public java.util.regex.Pattern getPattern()
getPattern
in interface Field
public void setPattern(java.util.regex.Pattern pattern)
setPattern
in interface Field
pattern
- Pattern containing the regex pattern used to identify
this field.public boolean isRequired()
isRequired
in interface Field
public void setRequired(java.lang.Boolean required)
setRequired
in interface Field
required
- Flag to indicate whether this field is required.public java.lang.String getDefault()
getDefault
in interface Field
public void setDefault(java.lang.String def)
setDefault
in interface Field
def
- String representation of the default value of this field.public void setProperties(java.util.Properties props)
setProperties
in interface Field
props
- Field specific properties.public java.lang.String getProperty(java.lang.String name)
getProperty
in interface Field
name
- Property name.
public java.util.Properties getProperties()
getProperties
in interface Field
protected java.lang.String getResourceString(java.lang.String key, java.util.ResourceBundle bundle)
key
- The resource key.bundle
- The resource bundle.
protected java.lang.String getResourceString(java.lang.String key, java.lang.Object[] args, java.util.ResourceBundle bundle) throws ValidationException
key
- The resource key.args
- Object array of arguments.bundle
- The resource bundle.
ValidationException
protected java.lang.String validateRequired(java.lang.String value, java.util.ResourceBundle bundle) throws ValidationException
value
- String to test.bundle
- ResourceBundle to use for localisation.
ValidationException
- if this field is reqiured and
the given value is empty/null and no default is available.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |