org.glassfish.jersey.server.model
Class ResourceMethod

java.lang.Object
  extended by org.glassfish.jersey.server.model.ResourceMethod
All Implemented Interfaces:
NameBound, Consuming, Producing, ResourceModelComponent, Suspendable

public final class ResourceMethod
extends Object
implements ResourceModelComponent, Producing, Consuming, Suspendable, NameBound

Model of a method available on a resource. Covers resource method, sub-resource method and sub-resource locator.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class ResourceMethod.Builder
          Resource method model builder.
static class ResourceMethod.JaxrsType
          Resource method classification based on the recognized JAX-RS resource method types.
 
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.
 List<? extends ResourceModelComponent> getComponents()
          Should return all existing resource model sub-components.
 List<javax.ws.rs.core.MediaType> getConsumedTypes()
          Get the consumed media types supported by the component.
 String getHttpMethod()
          Get the associated HTTP method.
 Invocable getInvocable()
          Get the invocable method model.
 Collection<Class<? extends Annotation>> getNameBindings()
           
 Resource getParent()
          Get the parent resource for this resource method model.
 List<javax.ws.rs.core.MediaType> getProducedTypes()
          Get the produced media types supported by the component.
 long getSuspendTimeout()
          Get the suspend timeout value in the given time unit.
 TimeUnit getSuspendTimeoutUnit()
          Get the suspend timeout value time unit.
 ResourceMethod.JaxrsType getType()
          Get the JAX-RS method type.
 boolean isManagedAsyncDeclared()
          Check if the component is marked to be executed asynchronously by using an internal Jersey executor service.
 boolean isNameBound()
           
 boolean isSuspendDeclared()
          Check if the component is marked for suspending.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getParent

public Resource getParent()
Get the parent resource for this resource method model.

May return null in case the resource method is not bound to an existing resource. This is typical for resource method models returned directly from the ResourceMethod.Builder.build() method.

Returns:
parent resource, or null if there is no parent resource associated with the method.
Since:
2.1

getType

public ResourceMethod.JaxrsType getType()
Get the JAX-RS method type.

Returns:
the JAX-RS method type.

getHttpMethod

public String getHttpMethod()
Get the associated HTTP method.

May return null in case the method represents a sub-resource locator.

Returns:
the associated HTTP method, or null in case this method represents a sub-resource locator.

getInvocable

public Invocable getInvocable()
Get the invocable method model.

Returns:
invocable method model.

getConsumedTypes

public List<javax.ws.rs.core.MediaType> getConsumedTypes()
Description copied from interface: Consuming
Get the consumed media types supported by the component.

Specified by:
getConsumedTypes in interface Consuming
Returns:
immutable collection of supported consumed media types.

getProducedTypes

public List<javax.ws.rs.core.MediaType> getProducedTypes()
Description copied from interface: Producing
Get the produced media types supported by the component.

Specified by:
getProducedTypes in interface Producing
Returns:
immutable collection of supported produced media types.

getSuspendTimeout

public long getSuspendTimeout()
Description copied from interface: Suspendable
Get the suspend timeout value in the given time unit.

Specified by:
getSuspendTimeout in interface Suspendable
Returns:
suspend timeout value.

getSuspendTimeoutUnit

public TimeUnit getSuspendTimeoutUnit()
Description copied from interface: Suspendable
Get the suspend timeout value time unit.

Specified by:
getSuspendTimeoutUnit in interface Suspendable
Returns:
time unit of the suspend timeout value.

isSuspendDeclared

public boolean isSuspendDeclared()
Description copied from interface: Suspendable
Check if the component is marked for suspending.

Specified by:
isSuspendDeclared in interface Suspendable
Returns:
true if the component is marked for suspending, false otherwise.

isManagedAsyncDeclared

public boolean isManagedAsyncDeclared()
Description copied from interface: Suspendable
Check if the component is marked to be executed asynchronously by using an internal Jersey executor service.

Specified by:
isManagedAsyncDeclared in interface Suspendable
Returns:
true if the component is marked for managed asynchronous execution, false otherwise.

getComponents

public 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

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.

isNameBound

public boolean isNameBound()
Specified by:
isNameBound in interface NameBound

getNameBindings

public Collection<Class<? extends Annotation>> getNameBindings()
Specified by:
getNameBindings in interface NameBound

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.