@Deprecated
public class ElementFactory
extends java.lang.Object
Every element class exposing the IElement
interface should register itself
in the static class-loader code (static {} block) in order to be recognized by this class
factory. The requirements for registration are that the registering class expose the
IElement
interface and have a constructor taking the single argument of
a DataAdaptor
object. The constructor should fully initialize the object
according to the data available in the data adaptor.
The factory is useful in parsing XML files in using the XAL Model Lattice DTD format. Every IElement has a type code (in String format) which may be used to identify the class.
DataAdaptor
Modifier and Type | Method and Description |
---|---|
static IElement |
createIElement(java.lang.String strType)
Deprecated.
Create a IElement object based on information stored in a
DataAdaptor
object. |
static java.lang.Class<? extends IElement>[] |
getRegisteredClasses()
Deprecated.
Get array of class types for registered IElement classes.
|
static int |
getRegisteredCount()
Deprecated.
Get the total number of registered elements, both thin and thick.
|
static java.lang.String[] |
getRegisteredTypes()
Deprecated.
Get array of all element type strings, both thin and thick, that are
registered to class factory.
|
static void |
main(java.lang.String[] arrArgs)
Deprecated.
Class test driver
|
static boolean |
registerIElement(java.lang.String strType,
java.lang.Class<? extends IElement> clsType)
Deprecated.
Register the IElement exposing class with the class factory.
|
static void |
testCreation(java.io.PrintWriter os,
java.lang.String strType)
Deprecated.
Test element creation mechanism
|
static void |
testRegistration(java.io.PrintWriter os)
Deprecated.
Test element registration mechanism.
|
public static int getRegisteredCount()
public static java.lang.String[] getRegisteredTypes()
public static java.lang.Class<? extends IElement>[] getRegisteredClasses()
public static boolean registerIElement(java.lang.String strType, java.lang.Class<? extends IElement> clsType)
Element(DataAdaptor daptInit)
.
The type string in the argument strType
must be the same string
returned by the IElement
method getType():String
.
The argument clsType
is the Class
class of the
class being registered with this factory. The class must expose the
IElement
interface.
Example:
For the derived class ThinLens
the static block should
include the following:
static { ... registerIElement(ThinLens.s_strType, ThinLens.class) ... }
strType
- type identifier of the classclsType
- Class
class for registered classpublic static IElement createIElement(java.lang.String strType) throws java.lang.ClassNotFoundException, java.lang.InstantiationException
DataAdaptor
object.strType
- string type identifier for IElement concrete classIElement
exposing objectjava.lang.ClassNotFoundException
- unknown class or class does not have proper constructorDataFormatException
- data in adaptor does not conform to DTDjava.lang.NumberFormatException
- corrupted position fieldjava.lang.InstantiationException
- unknown error occurred during element constructionpublic static void main(java.lang.String[] arrArgs)
public static void testRegistration(java.io.PrintWriter os)
os
- output streampublic static void testCreation(java.io.PrintWriter os, java.lang.String strType)