public static final class ResourceMethod.Builder
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Set<javax.ws.rs.core.MediaType> |
consumedTypes |
private java.lang.reflect.Method |
definitionMethod |
private boolean |
encodedParams |
private boolean |
extended |
private java.lang.Class<?> |
handlerClass |
private java.lang.Object |
handlerInstance |
private java.util.Collection<Parameter> |
handlerParameters |
private java.lang.reflect.Method |
handlingMethod |
private java.lang.String |
httpMethod |
private boolean |
managedAsync |
private java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> |
nameBindings |
private Resource.Builder |
parent |
private java.util.Set<javax.ws.rs.core.MediaType> |
producedTypes |
private java.lang.reflect.Type |
routingResponseType |
private boolean |
suspended |
private long |
suspendTimeout |
private java.util.concurrent.TimeUnit |
suspendTimeoutUnit |
Constructor and Description |
---|
Builder(Resource.Builder parent)
Create a resource method builder.
|
Builder(Resource.Builder parent,
ResourceMethod originalMethod)
Create a builder from an existing resource method model.
|
Modifier and Type | Method and Description |
---|---|
ResourceMethod |
build()
Build the resource method model and register it with the parent
Resource.Builder . |
ResourceMethod.Builder |
consumes(java.util.Collection<javax.ws.rs.core.MediaType> types)
Add consumed media types supported by the component.
|
ResourceMethod.Builder |
consumes(javax.ws.rs.core.MediaType... types)
Add consumed media types supported by the component.
|
ResourceMethod.Builder |
consumes(java.lang.String... types)
Add consumed media types supported by the component.
|
private Invocable |
createInvocable() |
ResourceMethod.Builder |
encodedParameters(boolean value)
If set to
true , the parameter values will not be automatically
decoded. |
ResourceMethod.Builder |
extended(boolean extended)
Get the flag indicating whether the resource method is extended or is a core of exposed RESTful API.
|
ResourceMethod.Builder |
handledBy(java.lang.Class<?> handlerClass,
java.lang.reflect.Method method)
Define a resource method handler binding.
|
ResourceMethod.Builder |
handledBy(java.lang.Class<? extends Inflector> inflectorClass)
Define an inflector-based resource method handler binding.
|
ResourceMethod.Builder |
handledBy(Inflector<javax.ws.rs.container.ContainerRequestContext,?> inflector)
Define an inflector-based resource method handler binding.
|
ResourceMethod.Builder |
handledBy(java.lang.Object handlerInstance,
java.lang.reflect.Method method)
Define a resource method handler binding.
|
ResourceMethod.Builder |
handlerParameters(java.util.Collection<Parameter> parameters)
Parameters defined on the handler (i.e.
|
ResourceMethod.Builder |
handlingMethod(java.lang.reflect.Method handlingMethod)
Define a specific method of the handling class that will be executed.
|
ResourceMethod.Builder |
httpMethod(java.lang.String name)
Set the associated HTTP method name.
|
ResourceMethod.Builder |
managedAsync()
Set the managed async required flag on the method model to
true . |
ResourceMethod.Builder |
nameBindings(java.lang.annotation.Annotation... nameBindings)
Adds name bindings.
|
ResourceMethod.Builder |
nameBindings(java.lang.Class<? extends java.lang.annotation.Annotation>... nameBindings)
Adds name bindings.
|
ResourceMethod.Builder |
nameBindings(java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings)
Adds name bindings.
|
ResourceMethod.Builder |
produces(java.util.Collection<javax.ws.rs.core.MediaType> types)
Add produced media types supported by the component.
|
ResourceMethod.Builder |
produces(javax.ws.rs.core.MediaType... types)
Add produced media types supported by the component.
|
ResourceMethod.Builder |
produces(java.lang.String... types)
Add produced media types supported by the component.
|
ResourceMethod.Builder |
routingResponseType(java.lang.reflect.Type routingResponseType)
Define the response entity type used during the routing for
selection of the resource methods.
|
ResourceMethod.Builder |
suspended(long timeout,
java.util.concurrent.TimeUnit unit)
Mark the component for suspending.
|
private final Resource.Builder parent
private java.lang.String httpMethod
private final java.util.Set<javax.ws.rs.core.MediaType> consumedTypes
private final java.util.Set<javax.ws.rs.core.MediaType> producedTypes
private boolean managedAsync
private boolean suspended
private long suspendTimeout
private java.util.concurrent.TimeUnit suspendTimeoutUnit
private java.lang.Class<?> handlerClass
private java.lang.Object handlerInstance
private final java.util.Collection<Parameter> handlerParameters
private java.lang.reflect.Method definitionMethod
private java.lang.reflect.Method handlingMethod
private boolean encodedParams
private java.lang.reflect.Type routingResponseType
private final java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings
private boolean extended
Builder(Resource.Builder parent)
The supplied parent resource model builder will be called to register
the newly created resource method instance as part of the build()
method invocation.
Note that the build()
method does not have to be invoked manually
as the registration will happen automatically as part of the
Resource.Builder.build()
method
invocation.
parent
- parent resource model builder.Builder(Resource.Builder parent, ResourceMethod originalMethod)
parent
- parent resource model builder.originalMethod
- existing resource method model to create the builder from.public ResourceMethod.Builder httpMethod(java.lang.String name)
name
- HTTP method name.public ResourceMethod.Builder produces(java.lang.String... types)
types
- produced media types.public ResourceMethod.Builder produces(javax.ws.rs.core.MediaType... types)
types
- produced media types.public ResourceMethod.Builder produces(java.util.Collection<javax.ws.rs.core.MediaType> types)
types
- produced media types.public ResourceMethod.Builder consumes(java.lang.String... types)
types
- consumed media types.public ResourceMethod.Builder consumes(javax.ws.rs.core.MediaType... types)
types
- consumed media types.public ResourceMethod.Builder consumes(java.util.Collection<javax.ws.rs.core.MediaType> types)
types
- consumed media types.public ResourceMethod.Builder nameBindings(java.util.Collection<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings)
NameBinding
meta-annotation will be ignored.nameBindings
- collection of name binding annotation types.@SafeVarargs public final ResourceMethod.Builder nameBindings(java.lang.Class<? extends java.lang.annotation.Annotation>... nameBindings)
NameBinding
meta-annotation will be ignored.nameBindings
- name binding annotation types.public ResourceMethod.Builder nameBindings(java.lang.annotation.Annotation... nameBindings)
NameBinding
meta-annotation will be ignored.nameBindings
- name binding annotations.public ResourceMethod.Builder suspended(long timeout, java.util.concurrent.TimeUnit unit)
timeout
- suspend timeout value.unit
- suspend timeout time unit.public ResourceMethod.Builder managedAsync()
true
.public ResourceMethod.Builder encodedParameters(boolean value)
true
, the parameter values will not be automatically
decoded.
Defaults to false
.value
- true
if the automatic parameter decoding should be
disabled, false otherwise.Encoded
public ResourceMethod.Builder handledBy(java.lang.Class<?> handlerClass, java.lang.reflect.Method method)
handlerClass
- concrete resource method handler class.method
- method that will be executed as a resource method. The parameters initializes
invocable
definition method
.public ResourceMethod.Builder handledBy(java.lang.Object handlerInstance, java.lang.reflect.Method method)
handlerInstance
- concrete resource method handler instance.method
- handling method.public ResourceMethod.Builder handledBy(Inflector<javax.ws.rs.container.ContainerRequestContext,?> inflector)
inflector
- inflector handling the resource method.public ResourceMethod.Builder handledBy(java.lang.Class<? extends Inflector> inflectorClass)
inflectorClass
- class of the inflector handling the resource method.public ResourceMethod.Builder handlerParameters(java.util.Collection<Parameter> parameters)
parameters
- handler parameters to be added to the set of handler parameters for the method.public ResourceMethod.Builder handlingMethod(java.lang.reflect.Method handlingMethod)
handledBy()
builder methods.handlingMethod
- specific handling method.public ResourceMethod.Builder routingResponseType(java.lang.reflect.Type routingResponseType)
Invocable.getRoutingResponseType()
will be equal to
Invocable.getResponseType()
which
is the default configuration state.routingResponseType
- Routing response type.Invocable.getRoutingResponseType()
public ResourceMethod.Builder extended(boolean extended)
ResourceMethod.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.
extended
- If true
then resource method is marked as extended.ExtendedResource
public ResourceMethod build()
Resource.Builder
.private Invocable createInvocable()