org.codegist.crest
Class DefaultCRest

java.lang.Object
  extended by org.codegist.crest.DefaultCRest
All Implemented Interfaces:
Disposable, CRest

public class DefaultCRest
extends Object
implements CRest, Disposable

Default CRest implementation based on CRestContext interface data model.

On top of the behavior described in CRest, this implementation adds :

- RequestInterceptor to intercept any requests before it gets fired.

- Serializer to customize the serialization process of any types.

- Injector to inject complexe types that can't be reduced to a String via the serializers.

- ResponseHandler to customize response handling when interface method's response type is not one of raw types.

- ErrorHandler to customize how the created interface behaves when any error occurs during the method call process.

Author:
Laurent Gilles (laurent.gilles@codegist.org)

Constructor Summary
DefaultCRest(CRestContext context)
           
 
Method Summary
<T> T
build(Class<T> interfaze)
          Build rest-bounded instances of the given interface
 void dispose()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCRest

public DefaultCRest(CRestContext context)
Parameters:
context - The CRest configuration holder
Method Detail

build

public <T> T build(Class<T> interfaze)
        throws CRestException
Description copied from interface: CRest
Build rest-bounded instances of the given interface

Specified by:
build in interface CRest
Type Parameters:
T - Interface class to get the instance from
Parameters:
interfaze - Interface class to get the instance from
Returns:
An instance of the given interface
Throws:
CRestException - if anything goes wrong
See Also:
ResponseHandler, DefaultResponseHandler

dispose

public void dispose()
Specified by:
dispose in interface Disposable


Copyright © 2011. All Rights Reserved.