intarsys runtime library

de.intarsys.tools.dom
Class ElementTools

java.lang.Object
  extended by de.intarsys.tools.dom.ElementTools

public class ElementTools
extends Object


Constructor Summary
ElementTools()
           
 
Method Summary
static
<T> Class<T>
createClass(Element element, String classAttribute, Class<T> expectedClass, ClassLoader classLoader)
           
static IFunctor createFunctor(Element element, Object owner, ClassLoader classLoader)
           
static
<T> T
createObject(Element element, Class<T> expectedClass, ClassLoader classLoader)
           
static
<T> T
createObject(Element element, String role, Class<T> expectedClass, ClassLoader classLoader)
           
static
<T> T
createObject(Object owner, Element element, Class<T> expectedClass, ClassLoader classLoader)
           
static
<T> T
createPropertyValue(Object owner, Element element, Class<T> expectedClass, ClassLoader classLoader)
           
static boolean getBoolean(Element element, String attributeName, boolean defaultValue)
           
static double getDouble(Element element, String attributeName, double defaultValue)
           
static Iterator<Element> getElementsIterator(Element parent)
           
static Iterator<Element> getElementsIterator(Element parent, String name)
           
static
<T extends EnumItem>
T
getEnumItem(Element element, String attributeName, EnumMeta<T> meta)
           
static
<T extends EnumItem>
T
getEnumItem(Element element, String attributeName, EnumMeta<T> meta, T defaultValue)
           
static Element getFirstElement(Element element, String name)
           
static float getFloat(Element element, String attributeName, float defaultValue)
           
static int getInt(Element element, String attributeName, int defaultValue)
           
static boolean getPathBoolean(Element element, String path, boolean defaultValue)
           
static double getPathDouble(Element element, String path, double defaultValue)
           
static float getPathFloat(Element element, String path, float defaultValue)
           
static int getPathInt(Element element, String path, int defaultValue)
           
static String getPathString(Element element, String path, String defaultValue)
           
static String getString(Element element, String name, String defaultValue)
           
static void setProperties(Object object, Element element, ClassLoader classLoader)
          Set properties in object based on the list of property information contained in element.
static void setProperty(Object object, Element element, ClassLoader classLoader)
          Set a property in object based on the property information contained in element.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementTools

public ElementTools()
Method Detail

createClass

public static <T> Class<T> createClass(Element element,
                                       String classAttribute,
                                       Class<T> expectedClass,
                                       ClassLoader classLoader)
                            throws ObjectCreationException
Throws:
ObjectCreationException

createFunctor

public static IFunctor createFunctor(Element element,
                                     Object owner,
                                     ClassLoader classLoader)
                              throws ObjectCreationException
Throws:
ObjectCreationException

createObject

public static <T> T createObject(Element element,
                                 Class<T> expectedClass,
                                 ClassLoader classLoader)
                      throws ObjectCreationException
Throws:
ObjectCreationException

createObject

public static <T> T createObject(Element element,
                                 String role,
                                 Class<T> expectedClass,
                                 ClassLoader classLoader)
                      throws ObjectCreationException
Throws:
ObjectCreationException

createObject

public static <T> T createObject(Object owner,
                                 Element element,
                                 Class<T> expectedClass,
                                 ClassLoader classLoader)
                      throws ObjectCreationException
Throws:
ObjectCreationException

createPropertyValue

public static <T> T createPropertyValue(Object owner,
                                        Element element,
                                        Class<T> expectedClass,
                                        ClassLoader classLoader)
                             throws ObjectCreationException
Throws:
ObjectCreationException

getBoolean

public static boolean getBoolean(Element element,
                                 String attributeName,
                                 boolean defaultValue)

getDouble

public static double getDouble(Element element,
                               String attributeName,
                               double defaultValue)

getElementsIterator

public static Iterator<Element> getElementsIterator(Element parent)

getElementsIterator

public static Iterator<Element> getElementsIterator(Element parent,
                                                    String name)

getEnumItem

public static <T extends EnumItem> T getEnumItem(Element element,
                                                 String attributeName,
                                                 EnumMeta<T> meta)

getEnumItem

public static <T extends EnumItem> T getEnumItem(Element element,
                                                 String attributeName,
                                                 EnumMeta<T> meta,
                                                 T defaultValue)

getFirstElement

public static Element getFirstElement(Element element,
                                      String name)

getFloat

public static float getFloat(Element element,
                             String attributeName,
                             float defaultValue)

getInt

public static int getInt(Element element,
                         String attributeName,
                         int defaultValue)

getPathBoolean

public static boolean getPathBoolean(Element element,
                                     String path,
                                     boolean defaultValue)

getPathDouble

public static double getPathDouble(Element element,
                                   String path,
                                   double defaultValue)

getPathFloat

public static float getPathFloat(Element element,
                                 String path,
                                 float defaultValue)

getPathInt

public static int getPathInt(Element element,
                             String path,
                             int defaultValue)

getPathString

public static String getPathString(Element element,
                                   String path,
                                   String defaultValue)

getString

public static String getString(Element element,
                               String name,
                               String defaultValue)

setProperties

public static void setProperties(Object object,
                                 Element element,
                                 ClassLoader classLoader)
                          throws FieldException,
                                 ObjectCreationException,
                                 FunctorInvocationException
Set properties in object based on the list of property information contained in element.

... ...

Parameters:
object -
element -
classLoader -
Throws:
FieldException
ObjectCreationException
FunctorInvocationException

setProperty

public static void setProperty(Object object,
                               Element element,
                               ClassLoader classLoader)
                        throws FieldException,
                               ObjectCreationException,
                               FunctorInvocationException
Set a property in object based on the property information contained in element.

Long form ... ... Short form ... ...

Parameters:
object -
element -
classLoader -
Throws:
FieldException
ObjectCreationException
FunctorInvocationException

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.