org.codegist.crest.config
Interface MethodConfig


public interface MethodConfig

Method configuration holder object.

Implementors must respect the following contract :

- No method return null except for the ones documented or when used as an override template (see Configs.override(MethodConfig, MethodConfig))

- Defaults values must either be taken from interface's defaults constant or from InterfaceContext.getProperties()'s defaults overrides.

- Every arguments of every methods in the interface must have it's respective ParamConfig configured in its respective MethodConfig object.

Author:
Laurent Gilles (laurent.gilles@codegist.org)
See Also:
MethodConfig, ParamConfig, InterfaceConfigFactory

Field Summary
static long DEFAULT_CO_TIMEOUT
          Default connection timeout applied when non specified.
static Class<? extends ErrorHandler> DEFAULT_ERROR_HANDLER
          Default error handler applied when non specified.
static HttpMethod DEFAULT_HTTP_METHOD
          Default http method applied when non specified.
static StaticParam[] DEFAULT_PARAMS
          Default method params.
static String DEFAULT_PATH
          Default url fragment applied when non specified.
static Class<? extends RequestInterceptor> DEFAULT_REQUEST_INTERCEPTOR
          Default request interceptor applied when non specified.
static Class<? extends ResponseHandler> DEFAULT_RESPONSE_HANDLER
          Default response handler applied when non specified.
static Class<? extends RetryHandler> DEFAULT_RETRY_HANDLER
          Default retry handler applied when non specified.
static long DEFAULT_SO_TIMEOUT
          Default socket timeout applied when non specified.
 
Method Summary
 Long getConnectionTimeout()
           
 ErrorHandler getErrorHandler()
           
 HttpMethod getHttpMethod()
           
 Method getMethod()
           
 ParamConfig getParamConfig(int index)
          Get the ParamConfig object holding the configuration of the method's arguments at the requested index.
 Integer getParamCount()
           
 String getPath()
          URL fragment specific to this methods.
 RequestInterceptor getRequestInterceptor()
           
 ResponseHandler getResponseHandler()
           
 RetryHandler getRetryHandler()
           
 Long getSocketTimeout()
           
 StaticParam[] getStaticParams()
           
 

Field Detail

DEFAULT_SO_TIMEOUT

static final long DEFAULT_SO_TIMEOUT
Default socket timeout applied when non specified.

See Also:
getSocketTimeout(), Constant Field Values

DEFAULT_CO_TIMEOUT

static final long DEFAULT_CO_TIMEOUT
Default connection timeout applied when non specified.

See Also:
getConnectionTimeout(), Constant Field Values

DEFAULT_PATH

static final String DEFAULT_PATH
Default url fragment applied when non specified.

See Also:
getPath(), Constant Field Values

DEFAULT_PARAMS

static final StaticParam[] DEFAULT_PARAMS
Default method params.

See Also:
getPath()

DEFAULT_HTTP_METHOD

static final HttpMethod DEFAULT_HTTP_METHOD
Default http method applied when non specified.

See Also:
getHttpMethod()

DEFAULT_RESPONSE_HANDLER

static final Class<? extends ResponseHandler> DEFAULT_RESPONSE_HANDLER
Default response handler applied when non specified.

See Also:
getResponseHandler()

DEFAULT_ERROR_HANDLER

static final Class<? extends ErrorHandler> DEFAULT_ERROR_HANDLER
Default error handler applied when non specified.

See Also:
getErrorHandler()

DEFAULT_REQUEST_INTERCEPTOR

static final Class<? extends RequestInterceptor> DEFAULT_REQUEST_INTERCEPTOR
Default request interceptor applied when non specified.

See Also:
getRequestInterceptor()

DEFAULT_RETRY_HANDLER

static final Class<? extends RetryHandler> DEFAULT_RETRY_HANDLER
Default retry handler applied when non specified.

See Also:
getRetryHandler()
Method Detail

getMethod

Method getMethod()
Returns:
The method being configured by the current object

getStaticParams

StaticParam[] getStaticParams()

getResponseHandler

ResponseHandler getResponseHandler()

getErrorHandler

ErrorHandler getErrorHandler()

getRequestInterceptor

RequestInterceptor getRequestInterceptor()

getSocketTimeout

Long getSocketTimeout()

getConnectionTimeout

Long getConnectionTimeout()

getRetryHandler

RetryHandler getRetryHandler()

getPath

String getPath()
URL fragment specific to this methods.

Doesn't contains the server part.

Full url is InterfaceConfig.getEndPoint() + InterfaceConfig.getContextPath() + getPath()

This value can contain placeholders that points to method arguments. For a path as /my-path/{2}/{0}/{2}.json?my-param={1}, any {n} placeholder will be replaced with the serialized parameter found at the respective method argument index when using the default parameter injector.

Returns:
the method url fragment
See Also:
InterfaceConfig.getEndPoint(), InterfaceConfig.getContextPath()

getHttpMethod

HttpMethod getHttpMethod()

getParamConfig

ParamConfig getParamConfig(int index)
Get the ParamConfig object holding the configuration of the method's arguments at the requested index.

Parameters:
index -
Returns:
The param config object at the specified index, null if not found.

getParamCount

Integer getParamCount()
Returns:
The param count.


Copyright © 2011. All Rights Reserved.