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