|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sapia.util.xml.confix.ReflectionFactory
public class ReflectionFactory
This class instantiates objects based on the name of XML elements, using these names to dynamically find the class of the objects to instantiate.
| Nested Class Summary | |
|---|---|
static class |
ReflectionFactory.NullObjectImpl
|
| Constructor Summary | |
|---|---|
ReflectionFactory(java.lang.String[] somePackages)
Creates a new ReflectionFactory instance with the arguments passed in. |
|
| Method Summary | |
|---|---|
void |
addPackage(java.lang.String aPackage)
Adds the package passed in to this factory. |
protected static java.lang.reflect.Method |
findVoidMethod(java.lang.Class owner,
java.lang.String name)
|
static java.lang.String |
firstToUpper(java.lang.String aString)
Utility to change the first letter of the string passed in to uppercase. |
protected static java.lang.Object |
invokeMethod(java.lang.String aMethodPrefix,
java.lang.String anElementName,
java.lang.Object aTarget)
Invokes a method on the target object using the method prefix and the element name passed in. |
protected static boolean |
invokeVoidMethod(java.lang.Object aTarget,
java.lang.String elementName)
|
CreationStatus |
newObjectFor(java.lang.String aPrefix,
java.lang.String aNamespaceURI,
java.lang.String anElementName,
java.lang.Object aParent)
Creates an object for the element passed in. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionFactory(java.lang.String[] somePackages)
somePackages - The package from which to use reflection.| Method Detail |
|---|
public static java.lang.String firstToUpper(java.lang.String aString)
protected static java.lang.Object invokeMethod(java.lang.String aMethodPrefix,
java.lang.String anElementName,
java.lang.Object aTarget)
aMethodPrefix - The prefix of the method to call (create, add, ...).anElementName - The element name for which we have to invoke a method.aTarget - The target object on which the method invocation is done.
protected static boolean invokeVoidMethod(java.lang.Object aTarget,
java.lang.String elementName)
protected static java.lang.reflect.Method findVoidMethod(java.lang.Class owner,
java.lang.String name)
public void addPackage(java.lang.String aPackage)
aPackage - The package to add.
public CreationStatus newObjectFor(java.lang.String aPrefix,
java.lang.String aNamespaceURI,
java.lang.String anElementName,
java.lang.Object aParent)
throws ObjectCreationException
newObjectFor in interface ObjectFactoryIFaPrefix - The namespace prefix of the element.aNamespaceURI - The namespace URI of the element.anElementName - The element name for wich to create an object.aParent - The parent object of the object to create.
ObjectCreationException - If an error occurs creating the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||