jaxp/src/java.xml/share/classes/javax/xml/xpath/XPath.java
changeset 35337 2ba279bcff39
parent 29999 8493f5fc1052
child 40483 cb7f243e782d
equal deleted inserted replaced
35336:c22ade6e6c86 35337:2ba279bcff39
   349      * corresponding to the types defined in the {@link XPathEvaluationResult.XPathResultType},
   349      * corresponding to the types defined in the {@link XPathEvaluationResult.XPathResultType},
   350      * or XPathEvaluationResult is specified as the type but an implementation supporting the
   350      * or XPathEvaluationResult is specified as the type but an implementation supporting the
   351      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
   351      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
   352      * @throws NullPointerException If {@code expression or type} is {@code null}.
   352      * @throws NullPointerException If {@code expression or type} is {@code null}.
   353      *
   353      *
   354      * @since 1.9
   354      * @since 9
   355      */
   355      */
   356     default <T>T evaluateExpression(String expression, Object item, Class<T> type)
   356     default <T>T evaluateExpression(String expression, Object item, Class<T> type)
   357         throws XPathExpressionException {
   357         throws XPathExpressionException {
   358         return type.cast(evaluate(expression, item,
   358         return type.cast(evaluate(expression, item,
   359                 XPathEvaluationResult.XPathResultType.getQNameType(type)));
   359                 XPathEvaluationResult.XPathResultType.getQNameType(type)));
   397      * @throws IllegalArgumentException If the implementation of this method
   397      * @throws IllegalArgumentException If the implementation of this method
   398      * does not support the
   398      * does not support the
   399      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
   399      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
   400      * @throws NullPointerException If {@code expression} is {@code null}.
   400      * @throws NullPointerException If {@code expression} is {@code null}.
   401      *
   401      *
   402      * @since 1.9
   402      * @since 9
   403      */
   403      */
   404     default XPathEvaluationResult<?> evaluateExpression(String expression, Object item)
   404     default XPathEvaluationResult<?> evaluateExpression(String expression, Object item)
   405         throws XPathExpressionException
   405         throws XPathExpressionException
   406     {
   406     {
   407         return evaluateExpression(expression, item, XPathEvaluationResult.class);
   407         return evaluateExpression(expression, item, XPathEvaluationResult.class);
   443      * XPathResultType}, or XPathEvaluationResult is specified as the type but an
   443      * XPathResultType}, or XPathEvaluationResult is specified as the type but an
   444      * implementation supporting the
   444      * implementation supporting the
   445      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
   445      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type is not available.
   446      * @throws NullPointerException If {@code expression, source or type}is {@code null}.
   446      * @throws NullPointerException If {@code expression, source or type}is {@code null}.
   447      *
   447      *
   448      * @since 1.9
   448      * @since 9
   449      */
   449      */
   450     default <T>T evaluateExpression(String expression, InputSource source, Class<T> type)
   450     default <T>T evaluateExpression(String expression, InputSource source, Class<T> type)
   451         throws XPathExpressionException
   451         throws XPathExpressionException
   452     {
   452     {
   453         return type.cast(evaluate(expression, source,
   453         return type.cast(evaluate(expression, source,
   484      * @throws IllegalArgumentException If the implementation of this method
   484      * @throws IllegalArgumentException If the implementation of this method
   485      * does not support the
   485      * does not support the
   486      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
   486      * {@link XPathEvaluationResult.XPathResultType#ANY ANY} type.
   487      * @throws NullPointerException If {@code expression or source} is {@code null}.
   487      * @throws NullPointerException If {@code expression or source} is {@code null}.
   488      *
   488      *
   489      * @since 1.9
   489      * @since 9
   490      */
   490      */
   491     default XPathEvaluationResult<?> evaluateExpression(String expression, InputSource source)
   491     default XPathEvaluationResult<?> evaluateExpression(String expression, InputSource source)
   492         throws XPathExpressionException
   492         throws XPathExpressionException
   493     {
   493     {
   494         return evaluateExpression(expression, source, XPathEvaluationResult.class);
   494         return evaluateExpression(expression, source, XPathEvaluationResult.class);