Class JAXBNavigator<T>

java.lang.Object
org.cip4.lib.xjdf.xml.internal.JAXBNavigator<T>
Type Parameters:
T - Entity type.

public class JAXBNavigator<T> extends Object
Navigator class which simplifies XPath handling using any JAXB object.
  • Constructor Details

    • JAXBNavigator

      public JAXBNavigator(T jaxbObj) throws javax.xml.bind.JAXBException, ParserConfigurationException
      Constructor performing the setup for simplifying XPath handling using any JAXB object.
      Parameters:
      jaxbObj - The jaxb object to be bound.
      Throws:
      javax.xml.bind.JAXBException - If binding fails.
      ParserConfigurationException - If binding fails.
  • Method Details

    • evaluateInt

      public final Integer evaluateInt(String xPathExpression) throws XPathExpressionException
      Evaluates an XPath expression and returns an Integer value as result.
      Parameters:
      xPathExpression - The expression to evaluate.
      Returns:
      Evaluation result as Integer
      Throws:
      XPathExpressionException - If an error occurs in the XPath expression.
    • evaluateDouble

      public final Double evaluateDouble(String xPathExpression) throws XPathExpressionException
      Evaluates an XPath expression and returns an Double value as result.
      Parameters:
      xPathExpression - The expression to evaluate.
      Returns:
      Evaluation result as Double
      Throws:
      XPathExpressionException - If an error occurs in the XPath expression.
    • evaluateString

      public final String evaluateString(String xPathExpression) throws XPathExpressionException
      Evaluates an XPath expression and returns an String value as result.
      Parameters:
      xPathExpression - The expression to evaluate.
      Returns:
      Evaluation result as String
      Throws:
      XPathExpressionException - If an error occurs in the XPath expression.
    • evaluateNode

      public final Object evaluateNode(String xPathExpression) throws XPathExpressionException
      Evaluates an XPath expression and returns the Object.
      Parameters:
      xPathExpression - The expression to evaluate.
      Returns:
      Evaluation result
      Throws:
      XPathExpressionException - If an error occurs in the XPath expression.
    • evaluateNodeList

      public final Object[] evaluateNodeList(String xPathExpression) throws XPathExpressionException
      Evaluates an XPath expression. This method works only for xml node lists.
      Parameters:
      xPathExpression - The expression to evaluate.
      Returns:
      Evaluation result
      Throws:
      XPathExpressionException - If an error occurs in the XPath expression.
    • addNamespace

      public final JAXBNavigator<T> addNamespace(String prefix, String namespaceUri)
      Adds a namespace to the xpath.
      Parameters:
      prefix - Namespace prefix.
      namespaceUri - URI of the namespace.
      Returns:
      this JAXBNavigator
    • getRoot

      public final T getRoot()
      Get the JAXB object.
      Returns:
      JAXB object.
    • sync

      public final JAXBNavigator<T> sync() throws javax.xml.bind.JAXBException, ParserConfigurationException
      Sync changes made on the object graph.
      Returns:
      this JAXBNavigator
      Throws:
      javax.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.
      ParserConfigurationException - If creating a W3C document fails.