ch6.complexPersistent
Class ComplexDataPersistent

java.lang.Object
  extended by ch6.complexPersistent.ComplexDataPersistent
All Implemented Interfaces:
java.io.Serializable

public class ComplexDataPersistent
extends java.lang.Object
implements java.io.Serializable

Annotate the bean so that advanced HTML form elements can be saved to a database.

The CollectionOfElements and IndexColumn annotations are used to save advanced HTML form elements to the database.

See Also:
Serialized Form

Field Summary
protected  java.lang.String comments
          Variable for the textarea element.
protected  java.lang.String[] extra
          Array for the checkbox group.
protected  double grade
          Variable for the single-select list.
protected  int happiness
          Variable for the radio group.
protected  java.lang.Long id
          Primary key for the table.
protected  java.lang.String secretCode
          Variable for the password element.
protected  java.lang.String[] team
          Array for the multiple-select list.
 
Constructor Summary
ComplexDataPersistent()
          Creates a new instance of RequestData
 
Method Summary
 java.lang.String getComments()
          Accessor for the textarea element.
 java.lang.String[] getExtra()
          Accessor for the textarea element.
 double getGrade()
          Mutator for the single-select list.
 int getHappiness()
          Accessor for the radio group.
 java.lang.Long getId()
          Accessor for the primary key for the table.
 java.lang.String getSecretCode()
          Accessor for the password field.
 java.lang.String[] getTeam()
          Accessor for the multiple-select list.
 void setComments(java.lang.String comments)
          Mutator for the textarea element.
 void setExtra(java.lang.String[] extra)
          Mutator for the textarea element.
 void setGrade(double grade)
          Mutator for the single-select list.
 void setHappiness(int happiness)
          Mutator for the radio group.
protected  void setId(java.lang.Long id)
          Mutarator for the primary key.
 void setSecretCode(java.lang.String code)
          Mutator for the password field.
 void setTeam(java.lang.String[] team)
          Mutator for the multiple-select list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.Long id
Primary key for the table.


secretCode

protected java.lang.String secretCode
Variable for the password element.


happiness

protected int happiness
Variable for the radio group. It is single-valued, since only one of the radio buttons can be selected. It can also be null.


extra

protected java.lang.String[] extra
Array for the checkbox group. It is multiple-valued since the checkbox group can have more than one box selected. It can also be null.


comments

protected java.lang.String comments
Variable for the textarea element. It is single-valued since it only contains one string.


grade

protected double grade
Variable for the single-select list. It is single-valued since only one option in the list can be selected. It cannot be null, since the first element in the list is the default selected element.


team

protected java.lang.String[] team
Array for the multiple-select list. It is multiple-valued since the list can have more than one option selected. It can also be null.

Constructor Detail

ComplexDataPersistent

public ComplexDataPersistent()
Creates a new instance of RequestData

Method Detail

getId

public java.lang.Long getId()
Accessor for the primary key for the table.

Annotated with Id and GenerateValue

Returns:
The key field for the database record

setId

protected void setId(java.lang.Long id)
Mutarator for the primary key. It is protected to prevent other classes from changing the key.

Parameters:
id - The id

setSecretCode

public void setSecretCode(java.lang.String code)
Mutator for the password field. It is single-valued, since only one of the radio buttons can be selected. It can also be null.

Parameters:
code - The element data from the request

getSecretCode

public java.lang.String getSecretCode()
Accessor for the password field. It is single-valued, since only one of the radio buttons can be selected. It can also be null.

Returns:
The password

setHappiness

public void setHappiness(int happiness)
Mutator for the radio group. It is single-valued, since only one of the radio buttons can be selected. It can also be null.

Parameters:
happiness - The element data from the request

setExtra

public void setExtra(java.lang.String[] extra)
Mutator for the textarea element. It is single-valued since it only contains one string.

Parameters:
extra - The element data from the request

setComments

public void setComments(java.lang.String comments)
Mutator for the textarea element. It is single-valued since it only contains one string.

Parameters:
comments - The element data from the request

getComments

public java.lang.String getComments()
Accessor for the textarea element. It is single-valued since it only contains one string.

Returns:
The comments The element data from the request

setGrade

public void setGrade(double grade)
Mutator for the single-select list. It is single-valued since only one option in the list can be selected. It cannot be null, since the first element in the list is the default selected element.

Parameters:
grade - The element data from the request

setTeam

public void setTeam(java.lang.String[] team)
Mutator for the multiple-select list. It is multiple-valued since the list can have more than one option selected. It can also be null.

Parameters:
team - The element data from the request

getHappiness

public int getHappiness()
Accessor for the radio group. It is single-valued, since only one of the radio buttons can be selected. It can also be null.

Use the SetByAttribute annotation with AttributeType.CHECKED to indicate that the HTML form element is initialised with the attribute Checked.

Returns:
The level of happines

getGrade

public double getGrade()
Mutator for the single-select list. It is single-valued since only one option in the list can be selected. It cannot be null, since the first element in the list is the default selected element.

Use the SetByAttribute annotation with AttributeType.SELECTED to indicate that the HTML form element is initialised with the attribute Selected.

Returns:
The grade

getExtra

public java.lang.String[] getExtra()
Accessor for the textarea element. It is single-valued since it only contains one string.

Use the SetByAttribute annotation with AttributeType.CHECKED to indicate that the HTML form element is initialised with the attribute Checked.

Use the CollectionOfElements and IndexColumn annotations to indicate to Hibernate that this is a multiple-valued element that should have its own related table the database.

Returns:
The list of extras

getTeam

public java.lang.String[] getTeam()
Accessor for the multiple-select list. It is multiple-valued since the list can have more than one option selected. It can also be null.

Use the SetByAttribute annotation with AttributeType.SELECTED to indicate that the HTML form element is initialised with the attribute Selected.

Use the CollectionOfElements and IndexColumn annotations to indicate to Hibernate that this is a multiple-valued element that should have its own related table the database.

Returns:
The values for the team