| java.lang.Object org.apache.turbine.services.intake.model.Field
All known Subclasses: org.apache.turbine.services.intake.model.ShortField, org.apache.turbine.services.intake.model.ComboKeyField, org.apache.turbine.services.intake.model.IntegerField, org.apache.turbine.services.intake.model.FileItemField, org.apache.turbine.services.intake.model.DateStringField, org.apache.turbine.services.intake.model.LongField, org.apache.turbine.services.intake.model.StringField, org.apache.turbine.services.intake.model.BooleanField, org.apache.turbine.services.intake.model.StringKeyField, org.apache.turbine.services.intake.model.AbstractNumberField,
Constructor Summary | |
public | Field(XmlField field, Group group) Constructs a field based on data in the xml specification
and assigns it to a Group. |
Method Summary | |
public void | dispose() Disposes the object after use. | protected void | doSetValue(ValueParser pp) | abstract protected void | doSetValue() Sets the value of the field from data in the parser. | public void | getDefault() | protected String | getDefaultValidator() Produces the fully qualified class name of the default validator. | public Object | getDefaultValue() | public String | getDisplayName() Get the display name of the field. | public String | getDisplaySize() Gets the diplay size of the field. | public Object | getEmptyValue() | public Group | getGroup() Returns the Group this field belongs to
or null if unknown. | public String | getHTMLString() Calls toString() on the object returned by getValue(),
unless null; and then it returns "", the empty String. | public Object | getInitialValue() Get the value used as a default. | public String | getKey() Get the key used to identify the field. | public Locale | getLocale() Returns the Locale used when localizing data for
this field, or null if unknown. | public String | getMaxSize() Gets the maximum size of the field. | public String | getMessage() Get any error message resulting from invalid input. | public String | getName() Gets the name of the field. | public void | getProperty(Object obj) | protected Object | getSafeEmptyValue() Provides access to emptyValue such that the value returned will be
acceptable as an argument parameter to Method.invoke. | public String | getStringValue() Gets the String representation of the Value. | public Object | getTestValue() Get the value input by a user that will be validated. | public Validator | getValidator() Gets the Validator object for this field. | public Object | getValue() Get the value of the field. | public String | getValueIfAbsent() Use in a hidden field assign a default value in the event the
field is absent from the query parameters. | public Field | init(ValueParser pp) Method called when this field (the group it belongs to) is
pulled from the pool. | public Field | init(Retrievable obj) Method called when this field or the group it belongs to is
pulled from the pool. | public boolean | isMultiValued() Flag to determine whether the field has been declared as multi-valued. | public boolean | isRequired() Flag to determine whether the field has been declared as required. | public boolean | isSet() Flag set to true, if the test value has been set by the parser (even to
an empty value, so don't used this to determine if the field contains a
non-empty value). | public boolean | isValid() Flag set to true, if the test value met the constraints. | public boolean | isValidated() Flag to determine whether the field has been validated. | public void | removeFromRequest() | abstract public void | setDefaultValue(String prop) Set the default Value. | public void | setDisplayName(String newDisplayName) Set the display name of the field. | abstract public void | setEmptyValue(String prop) Set the empty Value. | void | setInitialValue(Object obj) Set the value used as a default, in the event the field
has not been set yet. | public void | setMessage(String message) Sets an error message. | public void | setProperty(Object obj) Calls a setter method on obj, if this field has been set. | public void | setRequired(boolean v) Set whether this field is required to have a value. | public void | setRequired(boolean v, String message) Set the value of required. | void | setTestValue(Object obj) Set the value input by a user that will be validated. | public String | toString() Calls toString() on the object returned by getValue(),
unless null; and then it returns "", the empty String. | protected boolean | validate(ValueParser pp) | public boolean | validate() Compares request data with constraints and sets the valid flag. |
alwaysRequired | protected boolean alwaysRequired(Code) | | Is this field always required? This is only set through the XML file
|
defaultFieldPackage | final public static String defaultFieldPackage(Code) | | Default Field Package
|
defaultValidatorPackage | final public static String defaultValidatorPackage(Code) | | Default Validator Package
|
defaultValue | protected Object defaultValue(Code) | | Default value of the field
|
displayName | protected String displayName(Code) | | Display name of the field to be used on data entry forms...
|
emptyValue | protected Object emptyValue(Code) | | Value of the field to use if the mapped parameter is empty or non-existant
|
getter | final protected Method getter(Code) | | Getter method in the mapped object used to populate the field
|
group | final protected Group group(Code) | | Group to which the field belongs
|
ifRequiredMessage | protected String ifRequiredMessage(Code) | | Error message set on the field if required and not set by parser
|
initialized | protected boolean initialized(Code) | | Has the field has been set from the parser?
|
isDebugEnabled | protected boolean isDebugEnabled(Code) | | |
isMultiValued | final protected boolean isMultiValued(Code) | | Does this field accept multiple values?
|
key | final protected String key(Code) | | Key used to identify the field in the parser
|
log | protected Log log(Code) | | Logging
|
mapToObject | final protected String mapToObject(Code) | | Class name of the object to which the field is mapped
|
message | protected String message(Code) | | Error message, is any, resulting from validation
|
onError | protected Object onError(Code) | | Value of the field if an error occurs while getting
the value from the mapped object
|
required | protected boolean required(Code) | | Does the field require a value?
|
retrievable | protected Retrievable retrievable(Code) | | Mapped object used to set the initial field value
|
setFlag | protected boolean setFlag(Code) | | Has the field has been set from the parser?
|
setter | final protected Method setter(Code) | | Setter method in the mapped object used to store the value of field
|
validFlag | protected boolean validFlag(Code) | | Has the field passed the validation test?
|
validated | protected boolean validated(Code) | | Has the field been validated?
|
validator | protected Validator validator(Code) | | Used to validate the contents of the field
|
Field | public Field(XmlField field, Group group) throws IntakeException(Code) | | Constructs a field based on data in the xml specification
and assigns it to a Group.
Parameters: field - a XmlField value Parameters: group - a Group value throws: IntakeException - indicates the validator was not valid orcould not be loaded. throws: SystemError - only occurs is the Validation object does notextend InitableByConstraintMap |
dispose | public void dispose()(Code) | | Disposes the object after use. The method is called
when the Group is returned to its pool.
if overridden, super.dispose() should be called.
|
doSetValue | abstract protected void doSetValue()(Code) | | Sets the value of the field from data in the parser.
|
getDefault | public void getDefault()(Code) | | Loads the default value from the object
|
getDefaultValidator | protected String getDefaultValidator()(Code) | | Produces the fully qualified class name of the default validator.
class name of the default validator |
getDefaultValue | public Object getDefaultValue()(Code) | | Get the default Value
the default value |
getDisplayName | public String getDisplayName()(Code) | | Get the display name of the field. Useful for building
data entry forms. Returns name of field if no display
name has been assigned to the field by xml input file.
a String value |
getDisplaySize | public String getDisplaySize()(Code) | | Gets the diplay size of the field. This is useful when
building the HTML input tag. If no displaySize was set,
an empty string is returned.
|
getEmptyValue | public Object getEmptyValue()(Code) | | Get the Value to use if the field is empty
the value to use if the field is empty. |
getGroup | public Group getGroup()(Code) | | Returns the Group this field belongs to
or null if unknown.
The group this field belongs to. |
getHTMLString | public String getHTMLString()(Code) | | Calls toString() on the object returned by getValue(),
unless null; and then it returns "", the empty String.
Escapes " characters to be able to display these
in HTML form fields.
a String value |
getInitialValue | public Object getInitialValue() throws IntakeException(Code) | | Get the value used as a default. If the initial value has
not been set and a Retrievable object has
been associated with this field, the objects property will
be used as the initial value.
an Object value exception: IntakeException - indicates the value could not bereturned from the mapped object |
getKey | public String getKey()(Code) | | Get the key used to identify the field.
the query data key. |
getLocale | public Locale getLocale()(Code) | | Returns the Locale used when localizing data for
this field, or null if unknown.
Where to localize for. |
getMaxSize | public String getMaxSize()(Code) | | Gets the maximum size of the field. This is useful when
building the HTML input tag. The maxSize is set with the maxLength
rule. If this rul was not set, an enmpty string is returned.
|
getMessage | public String getMessage()(Code) | | Get any error message resulting from invalid input.
a String value |
getName | public String getName()(Code) | | Gets the name of the field.
name of the field as specified in the XML file. |
getSafeEmptyValue | protected Object getSafeEmptyValue()(Code) | | Provides access to emptyValue such that the value returned will be
acceptable as an argument parameter to Method.invoke. Subclasses
that deal with primitive types should ensure that they return an
appropriate value wrapped in the object wrapper class for the
primitive type.
the value to use when the field is empty or an Object thatwraps the empty value for primitive types. |
getStringValue | public String getStringValue()(Code) | | Gets the String representation of the Value. This is basically a wrapper
method for the toString method which doesn't seem to show anything on
screen if accessed from Template. Name is also more in line with getValue
method which returns the actual Object.
This is useful for displaying correctly formatted data such as dates,
such as 18/11/1968 instead of the toString dump of a Date Object.
the String Value |
getTestValue | public Object getTestValue()(Code) | | Get the value input by a user that will be validated.
an Object value |
getValidator | public Validator getValidator()(Code) | | Gets the Validator object for this field.
a Validator object |
getValue | public Object getValue()(Code) | | Get the value of the field. if a test value has been set, it
will be returned as is, unless it is so badly formed that the
validation could not parse it. In most cases the test value
is returned even though invalid, so that it can be returned to
the user to make modifications. If the test value is not set
the initial value is returned.
an Object value |
getValueIfAbsent | public String getValueIfAbsent()(Code) | | Use in a hidden field assign a default value in the event the
field is absent from the query parameters. Used to track checkboxes,
since they only show up if checked.
|
init | public Field init(ValueParser pp) throws IntakeException(Code) | | Method called when this field (the group it belongs to) is
pulled from the pool. The request data is searched to determine
if a value has been supplied for this field. If so, the value
is validated.
Parameters: pp - a ValueParser value a Field value throws: IntakeException - this exception is only thrown by subclassesoverriding this implementation. |
init | public Field init(Retrievable obj)(Code) | | Method called when this field or the group it belongs to is
pulled from the pool. The retrievable object can provide
a default value for the field, or using setProperty the field's
value can be transferred to the retrievable.
Parameters: obj - a Retrievable value a Field value |
isMultiValued | public boolean isMultiValued()(Code) | | Flag to determine whether the field has been declared as multi-valued.
value of isMultiValued. |
isRequired | public boolean isRequired()(Code) | | Flag to determine whether the field has been declared as required.
value of required. |
isSet | public boolean isSet()(Code) | | Flag set to true, if the test value has been set by the parser (even to
an empty value, so don't used this to determine if the field contains a
non-empty value). Validation will only be executed for fields that have
been set in this manner.
a boolean value |
isValid | public boolean isValid()(Code) | | Flag set to true, if the test value met the constraints.
Is also true, in the case the test value was not set,
unless this field has been marked as required.
a boolean value |
isValidated | public boolean isValidated()(Code) | | Flag to determine whether the field has been validated.
value of validated. |
removeFromRequest | public void removeFromRequest()(Code) | | Removes references to this group and its fields from the
query parameters
|
setDefaultValue | abstract public void setDefaultValue(String prop)(Code) | | Set the default Value. This value is used if
Intake should map this field to a new object.
Parameters: prop - The value to use if the field is mapped to a new object. |
setDisplayName | public void setDisplayName(String newDisplayName)(Code) | | Set the display name of the field. Display names are
used in building data entry forms and serve as a
user friendly description of the data contained in
the field.
|
setEmptyValue | abstract public void setEmptyValue(String prop)(Code) | | Set the empty Value. This value is used if Intake
maps a field to a parameter returned by the user and
the corresponding field is either empty (empty string)
or non-existant.
Parameters: prop - The value to use if the field is empty. |
setInitialValue | void setInitialValue(Object obj)(Code) | | Set the value used as a default, in the event the field
has not been set yet.
Parameters: obj - an Object value |
setMessage | public void setMessage(String message)(Code) | | Sets an error message. The field is also marked as invalid.
|
setProperty | public void setProperty(Object obj) throws IntakeException(Code) | | Calls a setter method on obj, if this field has been set.
throws: IntakeException - indicates a problem during the execution of theobject's setter method |
setRequired | public void setRequired(boolean v)(Code) | | Set whether this field is required to have a value. If the field
is already required due to a setting in the XML file, this method
can not set it to false.
Parameters: v - Value to assign to required. |
setRequired | public void setRequired(boolean v, String message)(Code) | | Set the value of required.
Parameters: v - a boolean value Parameters: message - override the value from intake.xml |
setTestValue | void setTestValue(Object obj)(Code) | | Set the value input by a user that will be validated.
Parameters: obj - an Object value |
toString | public String toString()(Code) | | Calls toString() on the object returned by getValue(),
unless null; and then it returns "", the empty String.
a String value |
validate | public boolean validate()(Code) | | Compares request data with constraints and sets the valid flag.
|
|
|