ch6.complexPersistent
Class ComplexDataPersistent

java.lang.Object
  extended by shared.PersistentBase
      extended by ch6.complexPersistent.ComplexDataPersistent

public class ComplexDataPersistent
extends PersistentBase

A bean that has complex form elements. For checkbox groups and multiple select groups, the properties are multiple-valued, so they are implemented with arrays. The bean uses Hibernate annotations to mark the class for persistence to a database.


Field Summary
protected  java.lang.String comments
          The text area field.
protected  java.lang.String[] extra
          The checkbox group.
protected  double grade
          The single select list.
protected  int happiness
          The radio group.
protected  java.lang.String secretCode
          The password field.
protected  java.lang.String[] team
          The multiple select list.
 
Fields inherited from class shared.PersistentBase
id
 
Constructor Summary
ComplexDataPersistent()
          Creates a new instance of ComplexDataPersistent
 
Method Summary
 java.lang.String getComments()
          Accessor.
 java.lang.String[] getExtra()
          Accessor.
 double getGrade()
          Accessor.
 int getHappiness()
          Accessor.
 java.lang.String getSecretCode()
          Mutator.
 java.lang.String[] getTeam()
          Accessor.
 void setComments(java.lang.String comments)
          Mutator.
 void setExtra(java.lang.String[] extra)
          Mutator.
 void setGrade(double grade)
          Mutator.
 void setHappiness(int happiness)
          Mutator.
 void setSecretCode(java.lang.String code)
          Mutator.
 void setTeam(java.lang.String[] team)
          Mutator.
 
Methods inherited from class shared.PersistentBase
getId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

secretCode

protected java.lang.String secretCode
The password field. It is single-valued.


happiness

protected int happiness
The radio group. It is single-valued and nullable.


extra

protected java.lang.String[] extra
The checkbox group. It is multiple-valued and nullable.


comments

protected java.lang.String comments
The text area field. It is single-valued.


grade

protected double grade
The single select list. It is single-valued.


team

protected java.lang.String[] team
The multiple select list. It is multiple-valued and nullable.

Constructor Detail

ComplexDataPersistent

public ComplexDataPersistent()
Creates a new instance of ComplexDataPersistent

Method Detail

setSecretCode

public void setSecretCode(java.lang.String code)
Mutator.

Parameters:
code - The value to be stored.

getSecretCode

public java.lang.String getSecretCode()
Mutator.

Returns:
The current value of the property.

setHappiness

public void setHappiness(int happiness)
Mutator.

Parameters:
happiness - The current value of the property.

setExtra

public void setExtra(java.lang.String[] extra)
Mutator.

Parameters:
extra - The value to be stored. It is an array, since this is a multiple-valued property.

setComments

public void setComments(java.lang.String comments)
Mutator.

Parameters:
comments - The value to be stored.

getComments

public java.lang.String getComments()
Accessor.

Returns:
The current value of the property.

setGrade

public void setGrade(double grade)
Mutator.

Parameters:
grade - The value to be stored.

setTeam

public void setTeam(java.lang.String[] team)
Mutator.

Parameters:
team - The value to be stored. It is an array, since this is a multiple-valued property.

getHappiness

public int getHappiness()
Accessor. Annotated as 'checked'.

Returns:
The current value of the property.

getGrade

public double getGrade()
Accessor. Annotated as 'selected'.

Returns:
The current value of the property.

getExtra

public java.lang.String[] getExtra()
Accessor. Annotated as 'checked'. It is marked with annotations so that the multiple values are stored in a related table in the database.

Returns:
The current value of the property. This is an array since this is a multiple-valued property.

getTeam

public java.lang.String[] getTeam()
Accessor. Annotated as 'selected'. It is marked with annotations so that the multiple values are stored in a related table in the database.

Returns:
The current value of the property. This is an array since this is a multiple-valued property.