public final class ResourceMethod extends java.lang.Object implements ResourceModelComponent, Producing, Consuming, Suspendable, NameBound
Modifier and Type | Class and Description |
---|---|
static class |
ResourceMethod.Builder
Resource method model builder.
|
(package private) static class |
ResourceMethod.Data
Immutable resource method data.
|
static class |
ResourceMethod.JaxrsType
Resource method classification based on the recognized JAX-RS
resource method types.
|
Modifier and Type | Field and Description |
---|---|
private ResourceMethod.Data |
data |
private Resource |
parent |
Constructor and Description |
---|
ResourceMethod(Resource parent,
ResourceMethod.Data data)
Create new resource method model instance.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(ResourceModelVisitor visitor)
A component should call the visitor back with an appropriate
visitor interface method to give it a chance to process.
|
java.util.List<? extends ResourceModelComponent> |
getComponents()
Should return all existing resource model sub-components.
|
java.util.List<javax.ws.rs.core.MediaType> |
getConsumedTypes()
Get the consumed media types supported by the component.
|
(package private) ResourceMethod.Data |
getData()
Get model data represented by this resource method.
|
java.lang.String |
getHttpMethod()
Get the associated HTTP method.
|
Invocable |
getInvocable()
Get the invocable method model.
|
java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> |
getNameBindings()
Get the collection of name bindings attached to this component.
|
Resource |
getParent()
Get the parent resource for this resource method model.
|
java.util.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 . |
java.util.concurrent.TimeUnit |
getSuspendTimeoutUnit()
Get the suspend
timeout value time unit. |
ResourceMethod.JaxrsType |
getType()
Get the JAX-RS method type.
|
boolean |
isExtended()
Get the flag indicating whether the resource method is extended or is a core of exposed RESTful API.
|
boolean |
isManagedAsyncDeclared()
Check if the component is marked to be executed asynchronously by using
an internal Jersey
executor service . |
boolean |
isNameBound()
Check if the component is bound or not.
|
boolean |
isSse()
Check whether the resource method will be producing Server-sent event stream.
|
boolean |
isSuspendDeclared()
Check if the component is marked for suspending.
|
java.lang.String |
toString() |
(package private) static java.util.List<ResourceMethod> |
transform(Resource parent,
java.util.List<ResourceMethod.Data> list)
Transform a collection of resource method data into resource method models.
|
private final ResourceMethod.Data data
private final Resource parent
ResourceMethod(Resource parent, ResourceMethod.Data data)
parent
- parent resource model.data
- resource method model data.static java.util.List<ResourceMethod> transform(Resource parent, java.util.List<ResourceMethod.Data> list)
parent
- parent resource model.list
- resource method data collection.ResourceMethod.Data getData()
public Resource getParent()
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.
null
if there is no parent resource associated with the method.public ResourceMethod.JaxrsType getType()
public java.lang.String getHttpMethod()
May return null
in case the method represents a sub-resource
locator.
null
in case this method
represents a sub-resource locator.public Invocable getInvocable()
public boolean isExtended()
Extended resource model components are helper components that are not considered as a core of a
RESTful API. These can be for example OPTIONS
resource methods
added by model processors
or application.wadl
resource producing the WADL. Both resource are rather supportive
than the core of RESTful API.
If not set the resource will not be defined as extended by default.
true
if the method is extended.ExtendedResource
public java.util.List<javax.ws.rs.core.MediaType> getConsumedTypes()
Consuming
getConsumedTypes
in interface Consuming
public java.util.List<javax.ws.rs.core.MediaType> getProducedTypes()
Producing
getProducedTypes
in interface Producing
public long getSuspendTimeout()
Suspendable
time unit
.getSuspendTimeout
in interface Suspendable
public java.util.concurrent.TimeUnit getSuspendTimeoutUnit()
Suspendable
timeout value
time unit.getSuspendTimeoutUnit
in interface Suspendable
public boolean isSuspendDeclared()
Suspendable
isSuspendDeclared
in interface Suspendable
true
if the component is marked for suspending,
false
otherwise.public boolean isSse()
true
if the resource method produces Server-sent event stream, false
otherwise.public boolean isManagedAsyncDeclared()
Suspendable
executor service
.isManagedAsyncDeclared
in interface Suspendable
true
if the component is marked for managed asynchronous execution,
false
otherwise.public java.util.List<? extends ResourceModelComponent> getComponents()
ResourceModelComponent
getComponents
in interface ResourceModelComponent
public void accept(ResourceModelVisitor visitor)
ResourceModelComponent
accept
in interface ResourceModelComponent
visitor
- resource model visitor.public boolean isNameBound()
NameBound
isNameBound
in interface NameBound
true
if the component is bound, false
otherwise.public java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> getNameBindings()
NameBound
getNameBindings
in interface NameBound
public java.lang.String toString()
toString
in class java.lang.Object