org.mule.api.model
Class InvocationResult

java.lang.Object
  extended by org.mule.api.model.InvocationResult

public class InvocationResult
extends Object

Tracks the state of an invocation on a component using an EntryPointResolver


Nested Class Summary
static class InvocationResult.State
           
 
Field Summary
static InvocationResult.State STATE_INVOKE_NOT_SUPPORTED
          Deprecated. 
static InvocationResult.State STATE_INVOKED_FAILED
          Deprecated. 
static InvocationResult.State STATE_INVOKED_SUCESSFUL
          Deprecated. 
 
Constructor Summary
InvocationResult(EntryPointResolver resolver, InvocationResult.State state)
          Will construct an InvocationResult with a given state.
InvocationResult(EntryPointResolver resolver, Object result, Method method)
          Creates a result with the result payload set.
 
Method Summary
 String getErrorMessage()
          Returns the error message set on this result or null if none has been set
 String getMethodCalled()
          Returns the name of the method invoked, this property is only set if the state of the invocation is InvocationResult.State.SUCCESSFUL
 Object getResult()
          The result of this invocation
 InvocationResult.State getState()
           
 boolean hasError()
          Returns true if an error message has been set on this result, false otherwise
 void setErrorMessage(String message)
          An optional error message can be set if the invocation state is not InvocationResult.State.SUCCESSFUL
 void setErrorNoMatchingMethods(Object component, Class<?>[] args)
           
 void setErrorNoMatchingMethodsCalled(Object component, String methods)
           
 void setErrorTooManyMatchingMethods(Object component, Class<?>[] argTypes, String methods)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_INVOKE_NOT_SUPPORTED

@Deprecated
public static final InvocationResult.State STATE_INVOKE_NOT_SUPPORTED
Deprecated. 

STATE_INVOKED_SUCESSFUL

@Deprecated
public static final InvocationResult.State STATE_INVOKED_SUCESSFUL
Deprecated. 

STATE_INVOKED_FAILED

@Deprecated
public static final InvocationResult.State STATE_INVOKED_FAILED
Deprecated. 
Constructor Detail

InvocationResult

public InvocationResult(EntryPointResolver resolver,
                        InvocationResult.State state)
Will construct an InvocationResult with a given state. The state must be either InvocationResult.State.NOT_SUPPORTED if the resolver performing the invocation knows that it cannot attempt to make the invocation InvocationResult.State.FAILED If an invocation attempt is made but fails InvocationResult.State.SUCCESSFUL If the invocation was successful Typically, this constructor is used when the state is InvocationResult.State.NOT_SUPPORTED or InvocationResult.State.FAILED

Parameters:
resolver - the resolver being used to make the invocation
state - the state of the result

InvocationResult

public InvocationResult(EntryPointResolver resolver,
                        Object result,
                        Method method)
Creates a result with the result payload set. The state of this result will be InvocationResult.State.SUCCESSFUL since only in this state will a result be set.

Parameters:
resolver - the resolver being used to make the invocation
result - the result of a successful invocation
method - the method invoke by this invocation
Method Detail

getMethodCalled

public String getMethodCalled()
Returns the name of the method invoked, this property is only set if the state of the invocation is InvocationResult.State.SUCCESSFUL

Returns:
the name of the method invoked

getResult

public Object getResult()
The result of this invocation

Returns:
an object or null if the result did not yield a result or because the state of this invocation result is either InvocationResult.State.NOT_SUPPORTED or InvocationResult.State.FAILED.

getState

public InvocationResult.State getState()
Returns:
the state of this invocation. Possible values are: InvocationResult.State.NOT_SUPPORTED if the resolver performing the invocation knows that it cannot attempt to make the invocation InvocationResult.State.FAILED If an invocation attempt is made but fails InvocationResult.State.SUCCESSFUL If the invocation was successful

setErrorMessage

public void setErrorMessage(String message)
An optional error message can be set if the invocation state is not InvocationResult.State.SUCCESSFUL

Parameters:
message - the error message

hasError

public boolean hasError()
Returns true if an error message has been set on this result, false otherwise

Returns:
true if an error message has been set on this result, false otherwise

getErrorMessage

public String getErrorMessage()
Returns the error message set on this result or null if none has been set

Returns:
the error message set on this result or null if none has been set

setErrorTooManyMatchingMethods

public void setErrorTooManyMatchingMethods(Object component,
                                           Class<?>[] argTypes,
                                           String methods)

setErrorNoMatchingMethods

public void setErrorNoMatchingMethods(Object component,
                                      Class<?>[] args)

setErrorNoMatchingMethodsCalled

public void setErrorNoMatchingMethodsCalled(Object component,
                                            String methods)


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.