A Java Factory

An Example Using Metadata and Java Reflection

 

Description: The objective of this example is to create a reusable and generic Manager class.
                        This class will take a table name and a java class name as parameters and generate
                        a new instance of the desired class based on the new class.
.

 

These are the Results Obtained when this Example Executes Properly


 

There is a total of 5 files that compose this example. These files are:

DBConnection.java -Establish connection to the database
Employee.java        - Defines Employee class
Department.java     - Defines Department class
Manager.java          - Factory Class
ManDriver.java      - Driver to test

1