sky.engine.field
Interface Field

All Known Implementing Classes:
BaseField, CharField, CharListField, EmailField, IntField, RangeField, SelectionField, SessionField, UrlField

public interface Field


Method Summary
 void addAlias(java.lang.String alias)
          An alternate name for this field which is usually the name of the database collumn to which this field maps to.
 void addValue(java.lang.String value)
          Call this function, only after calling checkValue, to add a value to this field.
 java.lang.String checkValue(java.lang.String value)
          Check the input parameter to ensure that its a valid value for this field or transform the input parameter into a valid value for this field.
 void clear()
          Clear all the aliases of this field.
 void destory()
          Destroy all contents and information of this field.
 java.util.ArrayList getAliases()
          Get all the aliases of this field.
 int getDataSize()
          Number of values that this field has.
 java.lang.String getHTMLData(int nPos)
          A field can hold multiple values and this function transforms the value at the given position according to HTML syntax rules.
 java.lang.String getName()
          Field name must be the same as the name of the HTML input field, Servlet parameter, or servelet session values that this field bounds to.
 boolean getRequired()
          Indicates whether this field must have a value.
 java.lang.String getSQLData(int nPos)
          A field can hold multiple values and this function transforms the value at the given position according to SQL syntax rules.
 java.lang.String getStringData(int nPos)
          A field can hold multiple values and this function transforms the value at the given position into a generic string.
 boolean hasAliases()
          Does this field have any mapping or back-end database column names.
 void removeAliases()
          Remove any aliases that this field may have to reset any mapping to database column names.
 void removeValues()
          Remove all values that this field has.
 java.lang.String toHTML()
          Get HTML code framgment for generating an HTML input field.
 java.lang.String toString()
          Get a string that represents all the values of this field.
 

Method Detail

getName

public java.lang.String getName()
Field name must be the same as the name of the HTML input field, Servlet parameter, or servelet session values that this field bounds to.

Returns:
name of the field.

getRequired

public boolean getRequired()
Indicates whether this field must have a value.

Returns:
true, if the field must have a value; otherwise, false.

addAlias

public void addAlias(java.lang.String alias)
An alternate name for this field which is usually the name of the database collumn to which this field maps to.


getAliases

public java.util.ArrayList getAliases()
Get all the aliases of this field.

Returns:
list of aliases.

removeAliases

public void removeAliases()
Remove any aliases that this field may have to reset any mapping to database column names.


hasAliases

public boolean hasAliases()
Does this field have any mapping or back-end database column names.

Returns:
true if mapping exists; otherwise, false.

checkValue

public java.lang.String checkValue(java.lang.String value)
                            throws ErrorMessage
Check the input parameter to ensure that its a valid value for this field or transform the input parameter into a valid value for this field.

Parameters:
value - input parameter that will be checked or transformed.
Returns:
final checked or transformed value.
Throws:
ErrorMessage - if the input parameter is not valid or cannot be transformed into a valid value for this field.

addValue

public void addValue(java.lang.String value)
              throws ErrorMessage
Call this function, only after calling checkValue, to add a value to this field. values are processed and maintained in the order in which they were added.

Parameters:
value - value that needs to be added to this field.
Throws:
ErrorMessage - if there is any problems or errors in adding the value.

getDataSize

public int getDataSize()
Number of values that this field has.

Returns:
value count

getSQLData

public java.lang.String getSQLData(int nPos)
A field can hold multiple values and this function transforms the value at the given position according to SQL syntax rules.

Parameters:
nPos - position of a given value that this field contains.
Returns:
SQL representation of field value.

getHTMLData

public java.lang.String getHTMLData(int nPos)
A field can hold multiple values and this function transforms the value at the given position according to HTML syntax rules.

Parameters:
nPos - position of a given value that the field contains.
Returns:
HTML representation of the field value.

getStringData

public java.lang.String getStringData(int nPos)
A field can hold multiple values and this function transforms the value at the given position into a generic string.

Parameters:
nPos - position of the given value that the field contains.
Returns:
String representation of the field value.

removeValues

public void removeValues()
Remove all values that this field has.


toString

public java.lang.String toString()
Get a string that represents all the values of this field.

Returns:
all the values of this field formattted as a string.

toHTML

public java.lang.String toHTML()
Get HTML code framgment for generating an HTML input field.

Returns:
HTML code fragment for generating HTML input field.

clear

public void clear()
Clear all the aliases of this field.


destory

public void destory()
Destroy all contents and information of this field.