All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jdsltools.testers.GenericFactory

java.lang.Object
   |
   +----jdsltools.testers.GenericFactory

public abstract class GenericFactory
extends Object
implements Factory
Abstract superclass for factories for the GenericTester. This class handles the basic reflection required to create instances of an object from its fully qualified class name

Author:
Mike Boilen (mgb)

Variable Index

 o iLocationNames
 o iLocations
 o iStructureNames
 o iStructures

Constructor Index

 o GenericFactory(String)
Class constructor.

Method Index

 o addLocation(Object)
Adds a location to the list of location that were created in this call to generate.
 o addLocationName(String)
Adds a names to the list of names for the locations being produced in this call to generate.
 o addStructure(Object)
Adds a structure to the list of structures that were created in this call to generate.
 o addStructureName(String)
Adds a names to the list of names for the structures being produced in this call to generate.
 o clear()
Deletes the names for structures and locations that were stored, and prepares the factory for another call to generate.
 o create()
Returns an instance of the class this GenericFactory is creating.
 o create(String)
Creates an instance of the class this GenericFactory is creating.
 o findConstructor(Class, Class[])
Finds the Constructor of the class that should be used to create the object.
 o generate(int, int)
Generates a data structure based on the type and position key.
 o location(int)
Returns the current container and a new location for that container
 o parser()
Gets the parser.
 o reqClass()
Gets the class that this factory creates.
 o setContainer(Object)
Sets the current container of the factory, so that the factory can generate locations like Position and Locator
 o setParser(TesterStringParser)
Sets the parser
 o testStructure()
Returns a TestStructure that contains all the information that was stored during this call to generate.

Variables

 o iStructureNames
 protected Vector iStructureNames
 o iLocationNames
 protected Vector iLocationNames
 o iStructures
 protected Vector iStructures
 o iLocations
 protected Vector iLocations

Constructors

 o GenericFactory
 public GenericFactory(String structureToCreate)
Class constructor. It sets up the factory to create instances of the object defined by structureTocreate.

Parameters:
stringToCreate - the fully qualified class name of the class that this factory should create.

Methods

 o parser
 public final TesterStringParser parser()
Gets the parser.

Returns:
the parser
 o setParser
 public void setParser(TesterStringParser pars)
Sets the parser

Parameters:
pars - The new Parser
 o create
 public Object create() throws InstantiationException
Returns an instance of the class this GenericFactory is creating. Requires that the specified class have a zero argument constructor.

Returns:
an instance of the class specified when the factory was created.
Throws: InstantiationException
if there was a problem creating the class.
 o create
 public Object create(String string) throws InstantiationException
Creates an instance of the class this GenericFactory is creating. Uses the string format defined in TesterStringParser to parse the parameters, except that the $ tags are not understood.

Parameters:
string - The parameters, in the format specified by TesterStringParser, to pass to the constructor.
Throws: InstantiationException
if there was a problem creating the class.
 o findConstructor
 public Constructor findConstructor(Class clazz,
                                    Class params[]) throws InstantiationException
Finds the Constructor of the class that should be used to create the object.

Parameters:
clazz - the class to create an instance of.
params - an array of Class objects that store the parameters to use.
Throws: InstantiationException
if the constructor could not be found
 o reqClass
 public final Class reqClass()
Gets the class that this factory creates.

Returns:
the Class this factory creates.
 o clear
 public final void clear()
Deletes the names for structures and locations that were stored, and prepares the factory for another call to generate.

 o addStructureName
 public final void addStructureName(String name)
Adds a names to the list of names for the structures being produced in this call to generate.

Parameters:
name - the name of the structure to append to the list.
 o addLocationName
 public final void addLocationName(String name)
Adds a names to the list of names for the locations being produced in this call to generate.

Parameters:
name - the name of the location to append to the list.
 o addStructure
 public final void addStructure(Object structure)
Adds a structure to the list of structures that were created in this call to generate.

Parameters:
structure - the structure that was created.
 o addLocation
 public final void addLocation(Object location)
Adds a location to the list of location that were created in this call to generate.

Parameters:
location - the location that was created.
 o testStructure
 public TestStructure testStructure()
Returns a TestStructure that contains all the information that was stored during this call to generate.

Returns:
a TestStructure that is suitable for use with a subclass of GenericTester.

All Packages  Class Hierarchy  This Package  Previous  Next  Index