All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.serializabletypes.Adult

java.lang.Object
   |
   +----JBMSTours.serializabletypes.Person
           |
           +----JBMSTours.serializabletypes.Adult

public class Adult
extends Person
implements Externalizable
Look at the Source.

An Adult is a subclass of a Person. Persons are members of groups. This class illustrates how you can store a subclass--you can store any subclass of Person in the People table. This is a highly simplified example of a an object. Normally, if data is this simple, store it as relational data.

Use INSTANCEOF CLASS.JBMSTours.serializabletypes.Adult to select only members of the subclass. Persons get stored in the People Table. BuildATour constructs the People objects.

See Also:
BuildATour, Group, Person, Child

Constructor Index

 o Adult()
 o Adult(String, String)
Constructor.
 o Adult(String, String, char)
Constructor.

Method Index

 o getPassportNumber()
Gets the passport number.
 o readExternal(ObjectInput)
 o setPassportNumber(String)
Sets the passport number for main person in group only.
 o setPassportNumberReturnSelf(String)
Sets the passport number for main person in group only, returns Object (for use in update statements).
 o writeExternal(ObjectOutput)

Constructors

 o Adult
 public Adult()
 o Adult
 public Adult(String first,
              String last)
Constructor. Takes a first name and a last name.

Parameters:
first - the first name.
last - the last name.
 o Adult
 public Adult(String first,
              String last,
              char a)
Constructor. Takes a first name, a last name, and a middle initial.

Parameters:
first - thefirst name.
last - the last name.
a - the middle initial.

Methods

 o setPassportNumber
 public void setPassportNumber(String number)
Sets the passport number for main person in group only.

Parameters:
number - the passportNumber
 o setPassportNumberReturnSelf
 public Person setPassportNumberReturnSelf(String number)
Sets the passport number for main person in group only, returns Object (for use in update statements). For example, with this method, you can do an update like this:

Update people SET person = CAST (person AS CLASS JBMSTours.serializabletypes.Adult).setPassportNumberReturnSelf('ABCD') WHERE person_id = 2

Parameters:
number - the passportNumber
 o getPassportNumber
 public String getPassportNumber()
Gets the passport number.

Returns:
s the passport number, if the person has one. Otherwise returns unknown.
 o writeExternal
 public void writeExternal(ObjectOutput out) throws IOException
Throws: IOException
if failure to read
Overrides:
writeExternal in class Person
 o readExternal
 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
Throws: IOException
thrown on failure to read
Throws: ClassNotFoundException
thrown on failure to convert
Overrides:
readExternal in class Person

All Packages  Class Hierarchy  This Package  Previous  Next  Index