edu.utexas.its.eis.tools.qwicap.servlet
Class FormControlValue

java.lang.Object
  extended by edu.utexas.its.eis.tools.qwicap.servlet.FormControlValue
All Implemented Interfaces:
Comparable<FormControlValue>, Iterable<String>
Direct Known Subclasses:
FormFileUpload

public class FormControlValue
extends Object
implements Comparable<FormControlValue>, Iterable<String>

Represents the control-name/current-value(s) pair for one or more successful controls of the same name in an XHTML form.

Author:
Chris W. Johnson

Method Summary
 int compareTo(FormControlValue Other)
          Compares the name of this form control with the name of another form control, specified as a FormControlValue object.
 boolean equals(Object Other)
          Tests the name and value(s) of this form control for equality with the name and value(s) of another FormControlValue object.
 String getName()
          Returns the name of the control that supplied this value, or values.
 String getValue()
          Returns the first value in the relevant form data set that was supplied by this control, or controls.
 String[] getValues()
          Returns all of the values in the relevant form data set that were supplied by this control, or controls.
 int hashCode()
           
 boolean isQwicapControl()
          Returns true if the control that supplied this value, or values, is owned by Qwicap and therefore reserved for its internal use, or false if the control was a normal part of the form.
 boolean isQwicapParameter()
          Deprecated. Use isQwicapControl() instead.
 Iterator<String> iterator()
          Returns an Iterator of the values in the relevant form data set that were supplied by this control, or controls.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object Other)
Tests the name and value(s) of this form control for equality with the name and value(s) of another FormControlValue object. The order of the values in each object will not affect the outcome of this comparison.

Overrides:
equals in class Object
Parameters:
Other - Another object, or null.
Returns:
true if the other object is an instance of FormControlValue, and its name and value(s) match the name of value(s) of this FormControlValue instance, false otherwise.

compareTo

public int compareTo(FormControlValue Other)
Compares the name of this form control with the name of another form control, specified as a FormControlValue object.

Specified by:
compareTo in interface Comparable<FormControlValue>
Parameters:
Other - A FormControlValue object whose name should be compared to the name of this FormControlValue object.
Returns:
A negative integer, zero, or a positive integer as this form control's name is less than, equal to, or greater than the name of the specified form control object.

getName

public final String getName()
Returns the name of the control that supplied this value, or values.

Returns:
The name of the control that supplied this value, or values.

getValue

public String getValue()
Returns the first value in the relevant form data set that was supplied by this control, or controls. This method is unsuitable for controls like checkboxes which may provide multiple values; use getValues() when dealing such controls.

Returns:
The first value supplied by this control.
See Also:
getValues()

getValues

public String[] getValues()
Returns all of the values in the relevant form data set that were supplied by this control, or controls. Multiple values are supplied by controls like checkboxes, or by any set of simultaneously successful controls of the same name.

Returns:
The values of this parameter represented as String array. For efficiency, the array returned is this object's own master copy, and its contents should not be modified.

iterator

public Iterator<String> iterator()
Returns an Iterator of the values in the relevant form data set that were supplied by this control, or controls. Multiple values are supplied by controls like checkboxes, or by any set of simultaneously successful controls of the same name.

Specified by:
iterator in interface Iterable<String>
Returns:
An Iterator of the strings representing the values of this control.

isQwicapParameter

public boolean isQwicapParameter()
Deprecated. Use isQwicapControl() instead.

Returns true if the control that supplied this value, or values, is owned by Qwicap and therefore reserved for its internal use, or false if the control was a normal part of the form. To explain: Qwicap automatically adds hidden "input" controls to all forms for its internal use. The names of those controls are prefixed with the string "qwicap-" in order to avoid collisions with the names of the controls placed in the form by the web developer. This method makes it easy to distinguish between the values supplied by Qwicap's hidden controls, and the web application's own controls.

Returns:
true if the control that supplied this value, or values, is owned by Qwicap, and false if the control was a normal part of the form.

isQwicapControl

public boolean isQwicapControl()
Returns true if the control that supplied this value, or values, is owned by Qwicap and therefore reserved for its internal use, or false if the control was a normal part of the form. To explain: Qwicap automatically adds hidden "input" controls to all forms for its internal use. The names of those controls are prefixed with the string "qwicap-" in order to avoid collisions with the names of the controls placed in the form by the web developer. This method makes it easy to distinguish between the values supplied by Qwicap's hidden controls, and the web application's own controls.

Returns:
true if the control that supplied this value, or values, is owned by Qwicap, and false if the control was a normal part of the form.