com.jbbres.lib.actions.elements
Class ElementUtilities

java.lang.Object
  extended by com.jbbres.lib.actions.elements.ElementUtilities

public class ElementUtilities
extends java.lang.Object

Miscellaneous Element utility methods.


Release Notes:

v1.1.0:

  • Added method getDescription(Class)
  • Added method #newInstance(Class)
  • Since:
    1.0.0
    Version:
    1.1.0
    Author:
    Jean-Baptiste Bres

    Constructor Summary
    ElementUtilities()
               
     
    Method Summary
    static Element clone(Element element, Workflow workflow)
              Creates and returns a copy of the given Element.
    static boolean compare(Element element1, Element element2)
              Compares two elements.
    static ElementDescription<?> getDescription(java.lang.Class<? extends Element> elementClass)
              Extracts the element description object associated to a given Element class.
    static Element newInstance(java.lang.Class<? extends Element> elementClass, Workflow workflow)
              Creates and returns a new instance of the element class.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ElementUtilities

    public ElementUtilities()
    Method Detail

    compare

    public static boolean compare(Element element1,
                                  Element element2)
    Compares two elements.

    This methods returns true if and only if:

    Parameters:
    element1 - - the first element
    element2 - - the second element
    Returns:
    true if element1 and element2 are from the same class and have the same set of parameters; false otherwise.
    See Also:
    Hashtable.equals(Object)

    clone

    public static Element clone(Element element,
                                Workflow workflow)
    Creates and returns a copy of the given Element.

    This methods tries first to call the Object.clone() if the given element is an instance of Cloneable and has a public clone() method.
    If this does not succeed, the method creates a new Element calling Element.getDescription() .newElementInstance(workflow) and applies the parameters associated to the source element to the new one.

    Parameters:
    element - - the element to clone
    workflow - - the workflow that the clone should be associated to. The clone will not be added to the worflow.
    Returns:
    a clone of the element.

    getDescription

    public static ElementDescription<?> getDescription(java.lang.Class<? extends Element> elementClass)
                                                throws java.io.IOException
    Extracts the element description object associated to a given Element class.

    Parameters:
    clazz - - the Element class
    Returns:
    the element description
    Throws:
    java.io.IOException - Signals that an I/O exception has occurred.
    Since:
    1.1.0

    newInstance

    public static Element newInstance(java.lang.Class<? extends Element> elementClass,
                                      Workflow workflow)
                               throws java.io.IOException
    Creates and returns a new instance of the element class.

    Parameters:
    elementClass - the element class
    workflow - the workflow
    Returns:
    the created element
    Throws:
    java.io.IOException - Signals that an I/O exception has occurred.
    Since:
    1.1.0


    To file bugs or suggest feature enhancements, visit the app.jbbres.com Bug Reporter website.

    Additional documentation available online at http://app.jbbres.com/actions/developers.

    Copyright � 2009-2011 app.jbbres.com. All Rights Reserved.