org.glassfish.jersey.server.model
Class Invocable

java.lang.Object
  extended by org.glassfish.jersey.server.model.Invocable
All Implemented Interfaces:
Parameterized, ResourceModelComponent

public final class Invocable
extends java.lang.Object
implements Parameterized, ResourceModelComponent

A common interface for invocable resource components. This includes resource methods, sub-resource methods and sub-resource locators bound to a concrete handler class and a Java method (either directly or indirectly) declared & implemented by the handler class.

Invocable component information is used at runtime by a Java method dispatcher when processing requests.

Author:
Marek Potociar (marek.potociar at oracle.com)
See Also:
ResourceMethod, ResourceMethodDispatcher

Method Summary
 void accept(ResourceModelVisitor visitor)
          A component should call the visitor back with an appropriate visitor interface method to give it a chance to process.
static Invocable create(java.lang.Class<? extends Inflector> inflectorClass)
          Create a new resource method invocable model backed by an inflector class.
static
<T> Invocable
create(Inflector<Request,T> inflector)
          Create a new resource method invocable model backed by an inflector instance.
static Invocable create(MethodHandler handler, java.lang.reflect.Method handlingMethod)
          Create a new resource method invocable model.
static Invocable create(MethodHandler handler, java.lang.reflect.Method handlingMethod, boolean encodedParameters)
          Create a new resource method invocable model.
 java.util.List<? extends ResourceModelComponent> getComponents()
          Should return all existing resource model sub-components.
 MethodHandler getHandler()
          Get the model of the resource method handler that will be used to invoke the handling resource method on.
 java.lang.reflect.Method getHandlingMethod()
          Getter for the Java method
 java.util.List<Parameter> getParameters()
          Provides access to all parameters associated with given Parameterized instance.
 java.lang.Class<?> getRawResponseType()
          Get the resource method raw response type.
 java.lang.reflect.Type getResponseType()
          Get the resource method generic response type information.
 boolean isInflector()
          Check if the invocable represents an inflector processing method.
 boolean requiresEntity()
          Provides information on presence of an entity parameter.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static <T> Invocable create(Inflector<Request,T> inflector)
Create a new resource method invocable model backed by an inflector instance.

Parameters:
inflector - inflector processing the request method.

create

public static Invocable create(java.lang.Class<? extends Inflector> inflectorClass)
Create a new resource method invocable model backed by an inflector class.

Parameters:
inflectorClass - inflector syb-type processing the request method.

create

public static Invocable create(MethodHandler handler,
                               java.lang.reflect.Method handlingMethod)
Create a new resource method invocable model. Parameter values will be automatically decoded.

Parameters:
handler - resource method handler.
handlingMethod - handling Java method.

create

public static Invocable create(MethodHandler handler,
                               java.lang.reflect.Method handlingMethod,
                               boolean encodedParameters)
Create a new resource method invocable model.

Parameters:
handler - resource method handler.
handlingMethod - handling Java method.
encodedParameters - true if the automatic parameter decoding should be disabled, false otherwise.

getHandler

public MethodHandler getHandler()
Get the model of the resource method handler that will be used to invoke the handling resource method on.

Returns:
resource method handler model.

getHandlingMethod

public java.lang.reflect.Method getHandlingMethod()
Getter for the Java method

Returns:
corresponding Java method

getResponseType

public java.lang.reflect.Type getResponseType()
Get the resource method generic response type information.

The returned value provides the Type information that contains additional generic declaration information for generic Java class types.

Returns:
resource method generic response type information.

getRawResponseType

public java.lang.Class<?> getRawResponseType()
Get the resource method raw response type.

The returned value provides information about the raw Java class.

Returns:
resource method raw response type information.

isInflector

public boolean isInflector()
Check if the invocable represents an inflector processing method.

Returns:
true, if this invocable represents an inflector invocation, false otherwise.

requiresEntity

public boolean requiresEntity()
Description copied from interface: Parameterized
Provides information on presence of an entity parameter.

Specified by:
requiresEntity in interface Parameterized
Returns:
true if entity parameter is present, false otherwise

getParameters

public java.util.List<Parameter> getParameters()
Description copied from interface: Parameterized
Provides access to all parameters associated with given Parameterized instance.

Specified by:
getParameters in interface Parameterized
Returns:
list of actual parameters

accept

public void accept(ResourceModelVisitor visitor)
Description copied from interface: ResourceModelComponent
A component should call the visitor back with an appropriate visitor interface method to give it a chance to process.

Specified by:
accept in interface ResourceModelComponent
Parameters:
visitor - resource model visitor.

getComponents

public java.util.List<? extends ResourceModelComponent> getComponents()
Description copied from interface: ResourceModelComponent
Should return all existing resource model sub-components.

Specified by:
getComponents in interface ResourceModelComponent
Returns:
list of all sub-components

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.