public abstract class Instantiator extends Object
<class name="class name">
<param name="parameter name">parameter value</param>
...
</class>
and
<anyelement class="class name">
<param name="parameter name">parameter value</param>
...
</anyname>
Param subtags are matched with 'setters' on the created object.| Constructor and Description |
|---|
Instantiator() |
| Modifier and Type | Method and Description |
|---|---|
static Class |
getClass(Element classElement) |
static Object |
getInstance(Class claz,
Element classElement,
Object... args)
Instantiates any object using an Dom Element and constructor arguments.
|
static Object |
getInstance(Element classElement,
Object... args) |
static Object |
getInstanceWithSubElement(Element element,
Object... args)
Instantiates on object with the first child with name 'class'.
|
static void |
setProperty(String name,
Class claz,
Object o,
String value)
Given the name of a property, a clazz, an object and a value, set the property on the
object.
|
public static Class getClass(Element classElement) throws ClassNotFoundException
ClassNotFoundException#getInstance(Class, Element, Object...)}public static Object getInstance(Element classElement, Object... args) throws SAXException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
SAXExceptionClassNotFoundExceptionNoSuchMethodExceptionInstantiationExceptionIllegalAccessExceptionInvocationTargetException#getInstance(Class, Element, Object...)}public static Object getInstance(Class claz, Element classElement, Object... args) throws SAXException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
classElement - a 'class' element with a 'name' attribute,
or any element with a 'class' attribute. Finally if this any element has no 'class' attribute, it will try
'name' too. If it hasn't either, it will try the body.args - Constructor arguments.null.NoSuchMethodError - If not matching constructor could be foundClassNotFoundException - If the specified class does not exist.SAXExceptionNoSuchMethodExceptionInstantiationExceptionIllegalAccessExceptionInvocationTargetExceptionpublic static void setProperty(String name, Class claz, Object o, String value)
Casting.toType(Class, Object).value - The value as a Stringpublic static Object getInstanceWithSubElement(Element element, Object... args) throws SAXException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
getInstance(Element, Object...).element - Element in which a child specifying a java object must be searched.null if no matching child found.SAXExceptionClassNotFoundExceptionNoSuchMethodExceptionInstantiationExceptionIllegalAccessExceptionInvocationTargetExceptionMMBase 1.9-SNAPSHOT - ${javadoctimestamp}