org.mule.impl.model.resolvers
Class AnnotatedEntryPointResolver
java.lang.Object
org.mule.model.resolvers.AbstractEntryPointResolver
org.mule.impl.model.resolvers.AnnotatedEntryPointResolver
- All Implemented Interfaces:
- EntryPointResolver
public class AnnotatedEntryPointResolver
- extends AbstractEntryPointResolver
A Mule EntryPointResolver
implementation that will resolve methods on a service class
that have Mule expression annotations such as Payload
, InboundHeaders
It will transform the received message to match the annotated method arguments. For example -
public Object doSomething(
@XPath ("/foo/bar") String bar,
@Payload Document doc,
@InboundHeaders("name") String name)
{
//do stuff
}
The component method above will be invoked by running the XPath expression on the payload, adding a second parameter as
the payload itself and passing in the header 'name' as the third parameter.
There are some rules for how components with annotations will be processed -
- For components with more than one method annotated with Mule expression annotations the method name to call needs
to be set on the incoming message or endpoint using the
MuleProperties.MULE_METHOD_PROPERTY
key.
- If the component has only one method annotated with Mule expression annotations there is no need to set the method name to invoke
- Every parameter on the method needs to be annotated
- Since:
- 3.0
- See Also:
Payload
,
InboundHeaders
,
InboundAttachments
,
OutboundHeaders
,
OutboundAttachments
,
Mule
Methods inherited from class org.mule.model.resolvers.AbstractEntryPointResolver |
addMethodByArguments, addMethodByName, getCacheKeyForPayload, getMethodByArguments, getMethodByName, getMethodCache, getPayloadFromMessage, invokeMethod, isAcceptVoidMethods, isSynchronizeCall, setAcceptVoidMethods, setSynchronizeCall |
AnnotatedEntryPointResolver
public AnnotatedEntryPointResolver()
invoke
public InvocationResult invoke(Object component,
MuleEventContext context)
throws Exception
- Throws:
Exception
getPayloadForMethod
protected Object[] getPayloadForMethod(Method method,
Object component,
MuleEventContext context)
throws TransformerException,
InitialisationException
- Throws:
TransformerException
InitialisationException
getPayloadFromMessageWithAnnotations
protected Object[] getPayloadFromMessageWithAnnotations(Method method,
MuleEventContext context)
throws TransformerException,
InitialisationException
- Throws:
TransformerException
InitialisationException
toString
public String toString()
- Overrides:
toString
in class AbstractEntryPointResolver
initCache
protected void initCache(Object component,
MuleEventContext context)
Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.