public class XPathParamMethodArgumentResolver extends Object implements MethodArgumentResolver
MethodArgumentResolver
that supports the @XPathParam
annotation.
This resolver supports parameters annotated with @XPathParam
that specifies the XPath expression
that should be bound to that parameter. The parameter can either a "natively supported" XPath type (boolean
, double
, String
, Node
, or NodeList
), or a type that is supported by the ConversionService
.
Constructor and Description |
---|
XPathParamMethodArgumentResolver() |
Modifier and Type | Method and Description |
---|---|
protected XPathFactory |
createXPathFactory()
Create a
XPathFactory that this resolver will use to create XPath objects. |
Object |
resolveArgument(MessageContext messageContext,
org.springframework.core.MethodParameter parameter)
Resolves the given parameter into a method argument.
|
void |
setConversionService(org.springframework.core.convert.ConversionService conversionService)
Sets the conversion service to use.
|
void |
setTransformerHelper(TransformerHelper transformerHelper) |
boolean |
supportsParameter(org.springframework.core.MethodParameter parameter)
Indicates whether the given method parameter is supported by this resolver.
|
public void setConversionService(org.springframework.core.convert.ConversionService conversionService)
Defaults to the default conversion service.
public void setTransformerHelper(TransformerHelper transformerHelper)
public boolean supportsParameter(org.springframework.core.MethodParameter parameter)
MethodArgumentResolver
supportsParameter
in interface MethodArgumentResolver
parameter
- the method parameter to checktrue
if this resolver supports the supplied parameter; false
otherwisepublic Object resolveArgument(MessageContext messageContext, org.springframework.core.MethodParameter parameter) throws TransformerException, XPathExpressionException
MethodArgumentResolver
resolveArgument
in interface MethodArgumentResolver
messageContext
- the current message contextparameter
- the parameter to resolve to an argument. This parameter must have previously been passed to
the MethodArgumentResolver.supportsParameter(MethodParameter)
method of this interface, which must
have returned true
.null
.TransformerException
XPathExpressionException
protected XPathFactory createXPathFactory()
XPathFactory
that this resolver will use to create XPath
objects.
Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached, so this method will only be called once.
Copyright © 2020 Pivotal Software. All rights reserved.