public class ProtocolRequestBuilder extends Object
HttpRequest
builder for ProtocolClient.protocol()
. See
the type(Annotation,Class)
, method(Annotation,Method)
,
parameter(Annotation,Parameter,...)
,
and parameter(Parameter,...)
methods for the supported protocol
interface, method, and method parameter Annotation
s and types.
Protocol API authors should consider designing protocol methods to throw
HttpResponseException
,
ClientProtocolException
, and
IOException
.
Supported type (interface) annotations:
Supported method annotations:
Element |
---|
FormParam |
POST |
PUT |
GET |
Produces |
OPTIONS |
PATCH |
CookieParam |
Consumes |
DELETE |
MatrixParam |
HEAD |
BeanParam |
Path |
HeaderParam |
PathParam |
QueryParam |
Supported method parameter annotations:
Supported method parameter types:
Modifier and Type | Field and Description |
---|---|
static Set<Class<? extends Annotation>> |
METHOD_ANNOTATIONS
Supported method annotations.
|
static Set<Class<? extends Annotation>> |
PARAMETER_ANNOTATIONS
Supported method parameter annotations.
|
static Set<Class<?>> |
PARAMETER_TYPES
Supported method parameter types.
|
static Set<Class<? extends Annotation>> |
TYPE_ANNOTATIONS
Supported type (interface) annotations.
|
Modifier | Constructor and Description |
---|---|
protected |
ProtocolRequestBuilder(ProtocolClient<?> client)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
HttpMessage |
build(Method method,
Object[] argv)
|
protected void |
method(BeanParam annotation,
Method method)
BeanParam method Annotation |
protected void |
method(Consumes annotation,
Method method)
Consumes method Annotation |
protected void |
method(CookieParam annotation,
Method method)
CookieParam method Annotation |
protected void |
method(DELETE annotation,
Method method)
DELETE method Annotation |
protected void |
method(FormParam annotation,
Method method)
FormParam method Annotation |
protected void |
method(GET annotation,
Method method)
GET method Annotation |
protected void |
method(HeaderParam annotation,
Method method)
HeaderParam method Annotation |
protected void |
method(HEAD annotation,
Method method)
HEAD method Annotation |
protected void |
method(MatrixParam annotation,
Method method)
MatrixParam method Annotation |
protected void |
method(OPTIONS annotation,
Method method)
OPTIONS method Annotation |
protected void |
method(PATCH annotation,
Method method)
PATCH method Annotation |
protected void |
method(Path annotation,
Method method)
Path method Annotation |
protected void |
method(PathParam annotation,
Method method)
PathParam method Annotation |
protected void |
method(POST annotation,
Method method)
POST method Annotation |
protected void |
method(Produces annotation,
Method method)
Produces method Annotation |
protected void |
method(PUT annotation,
Method method)
PUT method Annotation |
protected void |
method(QueryParam annotation,
Method method)
QueryParam method Annotation |
protected void |
parameter(BeanParam annotation,
Parameter parameter,
Object argument)
BeanParam method parameter Annotation |
protected void |
parameter(CookieParam annotation,
Parameter parameter,
Object argument)
CookieParam method parameter Annotation |
protected void |
parameter(FormParam annotation,
Parameter parameter,
Object argument)
FormParam method parameter Annotation |
protected void |
parameter(HeaderParam annotation,
Parameter parameter,
Object argument)
HeaderParam method parameter Annotation |
protected void |
parameter(MatrixParam annotation,
Parameter parameter,
Object argument)
MatrixParam method parameter Annotation |
protected void |
parameter(Parameter parameter,
HttpEntity argument)
HttpEntity method parameter |
protected void |
parameter(Parameter parameter,
HttpMessage argument)
HttpMessage method parameter |
protected void |
parameter(Parameter parameter,
Object argument)
Object method parameter |
protected void |
parameter(Parameter parameter,
URI argument)
URI method parameter |
protected void |
parameter(PathParam annotation,
Parameter parameter,
Object argument)
PathParam method parameter Annotation |
protected void |
parameter(QueryParam annotation,
Parameter parameter,
Object argument)
QueryParam method parameter Annotation |
protected void |
type(ApplicationPath annotation,
Class<?> type)
ApplicationPath type (interface) Annotation |
protected void |
type(ConstrainedTo annotation,
Class<?> type)
ConstrainedTo type (interface) Annotation |
protected void |
type(Consumes annotation,
Class<?> type)
Consumes type (interface) Annotation |
protected void |
type(Path annotation,
Class<?> type)
Path type (interface) Annotation |
protected void |
type(Produces annotation,
Class<?> type)
Produces type (interface) Annotation |
public static final Set<Class<? extends Annotation>> TYPE_ANNOTATIONS
public static final Set<Class<? extends Annotation>> METHOD_ANNOTATIONS
public static final Set<Class<? extends Annotation>> PARAMETER_ANNOTATIONS
public static final Set<Class<?>> PARAMETER_TYPES
protected ProtocolRequestBuilder(ProtocolClient<?> client)
client
- The ProtocolClient
.public HttpMessage build(Method method, Object[] argv) throws Throwable
method
- The interface Method
.argv
- The caller's arguments.HttpMessage
.Throwable
- If the call fails for any reason.protected void type(ApplicationPath annotation, Class<?> type) throws Throwable
ApplicationPath
type (interface) Annotation
annotation
- The ApplicationPath
Annotation
.type
- The annotated Class
.Throwable
- If the Annotation
cannot be
configured.protected void type(ConstrainedTo annotation, Class<?> type) throws Throwable
ConstrainedTo
type (interface) Annotation
annotation
- The ConstrainedTo
Annotation
.type
- The annotated Class
.Throwable
- If the Annotation
cannot be
configured.protected void type(Consumes annotation, Class<?> type) throws Throwable
Consumes
type (interface) Annotation
annotation
- The Consumes
Annotation
.type
- The annotated Class
.Throwable
- If the Annotation
cannot be
configured.protected void type(Path annotation, Class<?> type) throws Throwable
Path
type (interface) Annotation
annotation
- The Path
Annotation
.type
- The annotated Class
.Throwable
- If the Annotation
cannot be
configured.protected void type(Produces annotation, Class<?> type) throws Throwable
Produces
type (interface) Annotation
annotation
- The Produces
Annotation
.type
- The annotated Class
.Throwable
- If the Annotation
cannot be
configured.protected void method(BeanParam annotation, Method method) throws Throwable
BeanParam
method Annotation
annotation
- The BeanParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(Consumes annotation, Method method) throws Throwable
Consumes
method Annotation
annotation
- The Consumes
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(CookieParam annotation, Method method) throws Throwable
CookieParam
method Annotation
annotation
- The CookieParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(DELETE annotation, Method method) throws Throwable
DELETE
method Annotation
annotation
- The DELETE
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(FormParam annotation, Method method) throws Throwable
FormParam
method Annotation
annotation
- The FormParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(GET annotation, Method method) throws Throwable
GET
method Annotation
annotation
- The GET
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(HEAD annotation, Method method) throws Throwable
HEAD
method Annotation
annotation
- The HEAD
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(HeaderParam annotation, Method method) throws Throwable
HeaderParam
method Annotation
annotation
- The HeaderParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(MatrixParam annotation, Method method) throws Throwable
MatrixParam
method Annotation
annotation
- The MatrixParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(OPTIONS annotation, Method method) throws Throwable
OPTIONS
method Annotation
annotation
- The OPTIONS
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(PATCH annotation, Method method) throws Throwable
PATCH
method Annotation
annotation
- The PATCH
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(Path annotation, Method method) throws Throwable
Path
method Annotation
annotation
- The Path
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(PathParam annotation, Method method) throws Throwable
PathParam
method Annotation
annotation
- The PathParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(QueryParam annotation, Method method) throws Throwable
QueryParam
method Annotation
annotation
- The QueryParam
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(POST annotation, Method method) throws Throwable
POST
method Annotation
annotation
- The POST
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(Produces annotation, Method method) throws Throwable
Produces
method Annotation
annotation
- The Produces
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void method(PUT annotation, Method method) throws Throwable
PUT
method Annotation
annotation
- The PUT
Annotation
.method
- The annotated Method
.Throwable
- If the Annotation
cannot be
configured.protected void parameter(BeanParam annotation, Parameter parameter, Object argument) throws Throwable
BeanParam
method parameter Annotation
annotation
- The BeanParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the cookie
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(CookieParam annotation, Parameter parameter, Object argument) throws Throwable
CookieParam
method parameter Annotation
annotation
- The CookieParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the cookie
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(FormParam annotation, Parameter parameter, Object argument) throws Throwable
FormParam
method parameter Annotation
annotation
- The FormParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the form
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(HeaderParam annotation, Parameter parameter, Object argument) throws Throwable
HeaderParam
method parameter Annotation
annotation
- The HeaderParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the header
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(MatrixParam annotation, Parameter parameter, Object argument) throws Throwable
MatrixParam
method parameter Annotation
annotation
- The MatrixParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the matrix
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(PathParam annotation, Parameter parameter, Object argument) throws Throwable
PathParam
method parameter Annotation
annotation
- The PathParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the path
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(QueryParam annotation, Parameter parameter, Object argument) throws Throwable
QueryParam
method parameter Annotation
annotation
- The QueryParam
Annotation
.parameter
- The Method
Parameter
.argument
- The Object
representing the query
parameter value.Throwable
- If the Annotation
cannot be
configured.protected void parameter(Parameter parameter, HttpMessage argument) throws Throwable
HttpMessage
method parameterparameter
- The Method
Parameter
.argument
- The HttpMessage
.Throwable
- If the argument cannot be configured.protected void parameter(Parameter parameter, HttpEntity argument) throws Throwable
HttpEntity
method parameterparameter
- The Method
Parameter
.argument
- The HttpEntity
.Throwable
- If the argument cannot be configured.protected void parameter(Parameter parameter, URI argument) throws Throwable
URI
method parameterCopyright © 2015–2020 Allen D. Ball. All rights reserved.