Class XMLReflect

  • All Implemented Interfaces:
    XMLReflectConstants

    public class XMLReflect
    extends java.lang.Object
    implements XMLReflectConstants
    This helper class can be used to build Java object from their XML description.
    Version:
    $Id: XMLReflect.java 1810083 2017-09-29 10:39:45Z ssteiner $
    • Constructor Summary

      Constructors 
      Constructor Description
      XMLReflect()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object buildArgument​(org.w3c.dom.Element element)
      Limitation: Arguments *must* have a String based constructor.
      static java.lang.Object buildObject​(org.w3c.dom.Element element)
      Implementation helper: builds a generic object
      static java.lang.Object configureObject​(java.lang.Object obj, org.w3c.dom.Element element, org.w3c.dom.Element classDefiningElement)
      Implementation helper: configures a generic object
      static org.w3c.dom.Element getClassDefiningElement​(org.w3c.dom.Element element)
      Gets the defining class element
      static java.lang.reflect.Constructor getDeclaredConstructor​(java.lang.Class cl, java.lang.Class[] argClasses)
      Returns a constructor that has can be used for the input class types.
      static void setObjectProperty​(java.lang.Object obj, java.lang.String propertyName, java.lang.Object propertyValue)
      Sets the property with given name on object to the input value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NO_MATCHING_CONSTRUCTOR

        public static final java.lang.String NO_MATCHING_CONSTRUCTOR
        An error happened while trying to construct a test. No constructor matching the list of arguments could be found {0} : The test's class name {1} : The list of argument types for which no constructor was found
        See Also:
        Constant Field Values
    • Constructor Detail

      • XMLReflect

        public XMLReflect()
    • Method Detail

      • buildObject

        public static java.lang.Object buildObject​(org.w3c.dom.Element element)
                                            throws java.lang.Exception
        Implementation helper: builds a generic object
        Throws:
        java.lang.Exception
      • configureObject

        public static java.lang.Object configureObject​(java.lang.Object obj,
                                                       org.w3c.dom.Element element,
                                                       org.w3c.dom.Element classDefiningElement)
                                                throws java.lang.Exception
        Implementation helper: configures a generic object
        Throws:
        java.lang.Exception
      • setObjectProperty

        public static void setObjectProperty​(java.lang.Object obj,
                                             java.lang.String propertyName,
                                             java.lang.Object propertyValue)
                                      throws java.lang.Exception
        Sets the property with given name on object to the input value
        Throws:
        java.lang.Exception
      • getDeclaredConstructor

        public static java.lang.reflect.Constructor getDeclaredConstructor​(java.lang.Class cl,
                                                                           java.lang.Class[] argClasses)
        Returns a constructor that has can be used for the input class types.
      • buildArgument

        public static java.lang.Object buildArgument​(org.w3c.dom.Element element)
                                              throws java.lang.Exception
        Limitation: Arguments *must* have a String based constructor. Or be an object that takes a set of string based arguments.
        Throws:
        java.lang.Exception
      • getClassDefiningElement

        public static org.w3c.dom.Element getClassDefiningElement​(org.w3c.dom.Element element)
        Gets the defining class element