Package Summary  Overview Summary

method:evaluateExpression(java.lang.Object, java.lang.Class) [CHANGED]

  • evaluateExpression

    default <T> T evaluateExpression​(java.lang.Object item,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type .

    The parameter item represents the context the XPath expression will be operated on. The type of the context is implementation-dependent. If the value is null, the operation must have no dependency on the context, otherwise an XPathExpressionException will be thrown.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
         (T)evaluate(item, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Implementation Note:
    The type of the context is usually Node.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    item - The context the XPath expression will be evaluated in.
    type - The class type expected to be returned by the XPath expression, must be one of the types described in section 3.2 Class types in the package summary.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If type is null.
    Since:
    9
  • evaluateExpression

    default <T> T evaluateExpression​(java.lang.Object item,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type .

    The parameter item represents the context the XPath expression will be operated on. The type of the context is implementation-dependent. If the value is null, the operation must have no dependency on the context, otherwise an XPathExpressionException will be thrown.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
         (T)evaluate(item, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Implementation Note:
    The type of the context is usually Node.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    item - The context the XPath expression will be evaluated in.
    type - The class type expected to be returned by the XPath expression.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If type is null.
    Since:
    9
  • evaluateExpression

    default <T> T evaluateExpression​(java.lang.Object item,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type .

    The parameter item represents the context the XPath expression will be operated on. The type of the context is implementation-dependent. If the value is null, the operation must have no dependency on the context, otherwise an XPathExpressionException will be thrown.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
         (T)evaluate(item, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Implementation Note:
    The type of the context is usually Node.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    item - The context the XPath expression will be evaluated in.
    type - The class type expected to be returned by the XPath expression, must be one of the types described in section 3.2 Class types in the package summary.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If type is null.
    Since:
    9

method:evaluateExpression(org.xml.sax.InputSource, java.lang.Class) [CHANGED]

  • evaluateExpression

    default <T> T evaluateExpression​(InputSource source,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type

    This method builds a data model for the InputSource and calls evaluateExpression(Object item, Class type) on the resulting document object.

    By default, the JDK's data model is Document.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
               (T)evaluate(source, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    source - The InputSource of the document to evaluate over.
    type - The class type expected to be returned by the XPath expression, must be one of the types described in section 3.2 Class types in the package summary.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If source or type is null.
    Since:
    9
  • evaluateExpression

    default <T> T evaluateExpression​(InputSource source,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type

    This method builds a data model for the InputSource and calls evaluateExpression(Object item, Class type) on the resulting document object.

    By default, the JDK's data model is Document.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
               (T)evaluate(source, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    source - The InputSource of the document to evaluate over.
    type - The class type expected to be returned by the XPath expression.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If source or type is null.
    Since:
    9
  • evaluateExpression

    default <T> T evaluateExpression​(InputSource source,
                                     java.lang.Class<T> type)
                              throws XPathExpressionException
    
    Evaluate the compiled XPath expression in the specified context, and return the result with the type specified through the class type

    This method builds a data model for the InputSource and calls evaluateExpression(Object item, Class type) on the resulting document object.

    By default, the JDK's data model is Document.

    Implementation Requirements:
    The default implementation in the XPath API is equivalent to:
     
    
    
               (T)evaluate(source, XPathEvaluationResult.XPathResultType.getQNameType(type));
     
    
    Since the evaluate method does not support the ANY type, specifying XPathEvaluationResult as the type will result in IllegalArgumentException. Any implementation supporting the ANY type must override this method.
    Type Parameters:
    T - The class type that will be returned by the XPath expression.
    Parameters:
    source - The InputSource of the document to evaluate over.
    type - The class type expected to be returned by the XPath expression, must be one of the types described in section 3.2 Class types in the package summary.
    Returns:
    The result of evaluating the expression.
    Throws:
    XPathExpressionException - If the expression cannot be evaluated.
    java.lang.IllegalArgumentException - If type is not of the types corresponding to the types defined in the XPathResultType, or XPathEvaluationResult is specified as the type but an implementation supporting the ANY type is not available.
    java.lang.NullPointerException - If source or type is null.
    Since:
    9