All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.serializabletypes.Child
java.lang.Object
|
+----JBMSTours.serializabletypes.Person
|
+----JBMSTours.serializabletypes.Child
- public class Child
- extends Person
- implements Externalizable
Look at the Source.
A Child is a subclass of a Person. Persons are members of groups.
Persons get stored in the People Table.
This class illustrates how you can store a subclass in a table.
BuildATour constructs the People objects.
- See Also:
- BuildATour, Group, Person, Adult
-
Child()
-
-
Child(String, String)
- Constructor.
-
Child(String, String, char)
- Constructor.
-
Child(String, String, int)
- Constructor.
-
getParent()
- Gets the id number of the parent in the group.
-
parentInTable(Connection)
- Is the child's parent already in the table? Can be used in a check
constraint.
-
readExternal(ObjectInput)
-
-
setParent(int)
- Sets the id number child's parent.
-
writeExternal(ObjectOutput)
-
Child
public Child()
Child
public Child(String first,
String last)
- Constructor.
Takes a first name and a last name.
- Parameters:
- first - the first name.
- last - the last name.
Child
public Child(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.
Child
public Child(String first,
String last,
int pid)
- Constructor.
Takes a first name, a last name, a middle initial, and parentid.
- Parameters:
- first - thefirst name.
- last - the last name.
- pid - the parent's id
setParent
public void setParent(int pid)
- Sets the id number child's parent.
- Parameters:
- pid - id number of parent.
getParent
public int getParent()
- Gets the id number of the parent in the group.
parentInTable
public boolean parentInTable(Connection conn) throws SQLException
- Is the child's parent already in the table? Can be used in a check
constraint. If you want to ensure that a Child's parent exists
in the table when inserting the Child. Note, however, that this
won't prevent you from deleting the Parent later on. (A foreign key
constraint would prevent you from doing that.)
- Parameters:
- conn - Connection
- Returns:
- boolean if parent is in table.
- Throws: SQLException
- Thrown if there is an SQL error.
- Overrides:
- parentInTable in class Person
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Throws: IOException
- from write failures
- Overrides:
- writeExternal in class Person
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Throws: IOException
- from read failures
- Throws: ClassNotFoundException
- from conversion failures
- Overrides:
- readExternal in class Person
All Packages Class Hierarchy This Package Previous Next Index