Class JAXBNavigator<T>

  • Type Parameters:
    T - Entity type.

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

      Constructors 
      Constructor Description
      JAXBNavigator​(T jaxbObj)
      Constructor performing the setup for simplifying XPath handling using any JAXB object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JAXBNavigator<T> addNamespace​(java.lang.String prefix, java.lang.String namespaceUri)
      Adds a namespace to the xpath.
      java.lang.Double evaluateDouble​(java.lang.String xPathExpression)
      Evaluates an XPath expression and returns an Double value as result.
      java.lang.Integer evaluateInt​(java.lang.String xPathExpression)
      Evaluates an XPath expression and returns an Integer value as result.
      java.lang.Object evaluateNode​(java.lang.String xPathExpression)
      Evaluates an XPath expression and returns the Object.
      java.lang.Object[] evaluateNodeList​(java.lang.String xPathExpression)
      Evaluates an XPath expression.
      java.lang.String evaluateString​(java.lang.String xPathExpression)
      Evaluates an XPath expression and returns an String value as result.
      T getRoot()
      Get the JAXB object.
      JAXBNavigator<T> sync()
      Sync changes made on the object graph.
      • Methods inherited from class java.lang.Object

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

      • JAXBNavigator

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

      • evaluateInt

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

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

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

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

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

        public final JAXBNavigator<T> addNamespace​(java.lang.String prefix,
                                                   java.lang.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 jakarta.xml.bind.JAXBException,
                                           javax.xml.parsers.ParserConfigurationException
        Sync changes made on the object graph.
        Returns:
        this JAXBNavigator
        Throws:
        jakarta.xml.bind.JAXBException - If any unexpected problem occurs during the marshalling.
        javax.xml.parsers.ParserConfigurationException - If creating a W3C document fails.