org.jboss.shrinkwrap.descriptor.metadata
Class MetadataUtil

java.lang.Object
  extended by org.jboss.shrinkwrap.descriptor.metadata.MetadataUtil

public class MetadataUtil
extends Object

Utility class serving useful methods for extracting node and element information.

Author:
Ralf Battenfeld

Constructor Summary
MetadataUtil()
           
 
Method Summary
static String getAttributeValue(Element element, String name)
          Returns the attribute value for the given attribute name.
static Node getNextParentNodeWithAttr(Node parent, String attrName)
          Returns the next parent node which has the specific attribute name defined.
static boolean hasChildOf(Element parentElement, XsdElementEnum child)
          Checks the existence of a w3c child element.
static boolean hasChildsOf(Element parentElement, XsdElementEnum child)
          Checks the existence of a w3c child element.
static boolean hasParentOf(Element parentElement, XsdElementEnum parentEnum)
          Checks for the first parent node occurrence of the a w3c parentEnum element.
 void log(Metadata metadata)
          Logs out metadata information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataUtil

public MetadataUtil()
Method Detail

getAttributeValue

public static String getAttributeValue(Element element,
                                       String name)
Returns the attribute value for the given attribute name.

Parameters:
element - the w3c dom element.
name - the attribute name
Returns:
if present, the the extracted attribute value, otherwise null.

getNextParentNodeWithAttr

public static Node getNextParentNodeWithAttr(Node parent,
                                             String attrName)
Returns the next parent node which has the specific attribute name defined.

Parameters:
parent - the w3c node from which the search will start.
attrName - the attribute name which is searched for.
Returns:
a parent node, if the attribute is found, otherwise null.

hasChildOf

public static boolean hasChildOf(Element parentElement,
                                 XsdElementEnum child)
Checks the existence of a w3c child element.

Parameters:
parentElement - the element from which the search starts.
child - the XsdElementEnum specifying the child element.
Returns:
true, if found, otherwise false.

hasChildsOf

public static boolean hasChildsOf(Element parentElement,
                                  XsdElementEnum child)
Checks the existence of a w3c child element.

Parameters:
parentElement - the element from which the search starts.
child - the XsdElementEnum specifying the child element.
Returns:
true, if found, otherwise false.

hasParentOf

public static boolean hasParentOf(Element parentElement,
                                  XsdElementEnum parentEnum)
Checks for the first parent node occurrence of the a w3c parentEnum element.

Parameters:
parentElement - the element from which the search starts.
parentEnum - the XsdElementEnum specifying the parent element.
Returns:
true, if found, otherwise false.

log

public void log(Metadata metadata)
Logs out metadata information.

Parameters:
metadata -


Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.