org.jclouds.rest.internal
Class RestAnnotationProcessor<T>
java.lang.Object
   org.jclouds.rest.internal.RestAnnotationProcessor<T>
org.jclouds.rest.internal.RestAnnotationProcessor<T>
- public class RestAnnotationProcessor<T> 
- extends Object
Creates http methods based on annotations on a class or interface.
- Author:
- Adrian Cole
 
 
 
| Method Summary | 
|  void | addHeaderIfAnnotationPresentOnMethod(com.google.common.collect.Multimap<String,String> headers,
                                     Method method,
                                     Collection<Map.Entry<String,String>> tokenValues)
 | 
|  com.google.common.collect.Multimap<String,String> | buildHeaders(Collection<Map.Entry<String,String>> tokenValues,
             Method method,
             Object... args)
 | 
| static com.google.common.base.Function<Exception,?> | createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(com.google.inject.Injector injector,
                                                                Method method)
 | 
|  GeneratedHttpRequest<T> | createRequest(Method method,
              Object... args)
 | 
| static com.google.common.base.Function<HttpResponse,?> | createResponseParser(ParseSax.Factory parserFactory,
                     com.google.inject.Injector injector,
                     Method method,
                     HttpRequest request)
 | 
|  GeneratedHttpRequest<T> | decorateRequest(GeneratedHttpRequest<T> request)
 | 
| static com.google.common.collect.Multimap<String,String> | filterOutContentHeaders(com.google.common.collect.Multimap<String,String> headers)
 | 
| static HttpRequest | findHttpRequestInArgs(Object[] args)
 | 
| static Payload | findPayloadInArgs(Object[] args)
 | 
|  Method | getDelegateOrNull(Method in)
 | 
| static URI | getEndpointFor(Method method,
               Object[] args,
               com.google.inject.Injector injector)
 | 
| static URI | getEndpointInParametersOrNull(Method method,
                              Object[] args,
                              com.google.inject.Injector injector)
 | 
|  String | getHttpMethodOrConstantOrThrowException(Method method)
 | 
| static Set<String> | getHttpMethods(Method method)
 | 
| static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> | getJsonParserKeyForMethod(Method method)
 | 
| static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> | getJsonParserKeyForMethodAnType(Method method,
                                Type returnVal)
 | 
|  MapBinder | getMapPayloadBinderOrNull(Method method,
                          Object... args)
 | 
| static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> | getParserOrThrowException(Method method)
 | 
| static Type | getReturnTypeForMethod(Method method)
 | 
| static Class<? extends ParseSax.HandlerWithResult<?>> | getSaxResponseParserClassOrNull(Method method)
 | 
| static com.google.common.base.Function<HttpResponse,?> | getTransformerForMethod(Method method,
                        com.google.inject.Injector injector)
 | 
| static Map<Integer,Set<Annotation>> | indexWithOnlyOneAnnotation(Method method,
                           String description,
                           com.google.common.cache.Cache<Method,com.google.common.cache.Cache<Integer,Set<Annotation>>> toRefine)
 | 
| static URI | replaceQuery(javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilderProvider,
             URI in,
             String newQuery,
             Comparator<Map.Entry<String,String>> sorter,
             char... skips)
 | 
|  URI | replaceQuery(URI in,
             String newQuery,
             Comparator<Map.Entry<String,String>> sorter)
 | 
|  void | setCaller(ClassMethodArgs caller)
 | 
|  boolean | shouldAddHostHeader(Method method)
 | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
logger
protected Logger logger
BOUNDARY
public static final String BOUNDARY
- See Also:
- Constant Field Values
futureBooleanLiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<Boolean>> futureBooleanLiteral
futureStringLiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<String>> futureStringLiteral
futureVoidLiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<Void>> futureVoidLiteral
futureURILiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<URI>> futureURILiteral
futureInputStreamLiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<InputStream>> futureInputStreamLiteral
futureHttpResponseLiteral
public static final com.google.inject.TypeLiteral<com.google.common.util.concurrent.ListenableFuture<HttpResponse>> futureHttpResponseLiteral
RestAnnotationProcessor
@Inject
public RestAnnotationProcessor(com.google.inject.Injector injector,
                                      com.google.common.cache.Cache<Class<?>,Boolean> seedAnnotationCache,
                                      @Named(value="jclouds.api-version")
                                      String apiVersion,
                                      ParseSax.Factory parserFactory,
                                      HttpUtils utils,
                                      com.google.inject.TypeLiteral<T> typeLiteral)
                        throws ExecutionException
- Throws:
- ExecutionException
createResponseParser
public static com.google.common.base.Function<HttpResponse,?> createResponseParser(ParseSax.Factory parserFactory,
                                                                                   com.google.inject.Injector injector,
                                                                                   Method method,
                                                                                   HttpRequest request)
- 
 
getTransformerForMethod
public static com.google.common.base.Function<HttpResponse,?> getTransformerForMethod(Method method,
                                                                                      com.google.inject.Injector injector)
- 
 
createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation
public static com.google.common.base.Function<Exception,?> createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(com.google.inject.Injector injector,
                                                                                                                           Method method)
- 
 
getDelegateOrNull
public Method getDelegateOrNull(Method in)
- 
 
setCaller
public void setCaller(ClassMethodArgs caller)
- 
 
createRequest
public GeneratedHttpRequest<T> createRequest(Method method,
                                             Object... args)
- 
 
filterOutContentHeaders
public static com.google.common.collect.Multimap<String,String> filterOutContentHeaders(com.google.common.collect.Multimap<String,String> headers)
- 
 
replaceQuery
public URI replaceQuery(URI in,
                        String newQuery,
                        @Nullable
                        Comparator<Map.Entry<String,String>> sorter)
- 
 
replaceQuery
public static URI replaceQuery(javax.inject.Provider<javax.ws.rs.core.UriBuilder> uriBuilderProvider,
                               URI in,
                               String newQuery,
                               @Nullable
                               Comparator<Map.Entry<String,String>> sorter,
                               char... skips)
- 
 
getEndpointInParametersOrNull
public static URI getEndpointInParametersOrNull(Method method,
                                                Object[] args,
                                                com.google.inject.Injector injector)
                                         throws ExecutionException
- 
- Throws:
- ExecutionException
 
getEndpointFor
public static URI getEndpointFor(Method method,
                                 Object[] args,
                                 com.google.inject.Injector injector)
                          throws ExecutionException
- 
- Throws:
- ExecutionException
 
getParserOrThrowException
public static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> getParserOrThrowException(Method method)
- 
 
getJsonParserKeyForMethod
public static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> getJsonParserKeyForMethod(Method method)
- 
 
getReturnTypeForMethod
public static Type getReturnTypeForMethod(Method method)
- 
 
getJsonParserKeyForMethodAnType
public static com.google.inject.Key<? extends com.google.common.base.Function<HttpResponse,?>> getJsonParserKeyForMethodAnType(Method method,
                                                                                                                               Type returnVal)
- 
 
getSaxResponseParserClassOrNull
public static Class<? extends ParseSax.HandlerWithResult<?>> getSaxResponseParserClassOrNull(Method method)
- 
 
getMapPayloadBinderOrNull
public MapBinder getMapPayloadBinderOrNull(Method method,
                                           Object... args)
- 
 
getHttpMethods
public static Set<String> getHttpMethods(Method method)
- 
 
getHttpMethodOrConstantOrThrowException
public String getHttpMethodOrConstantOrThrowException(Method method)
- 
 
shouldAddHostHeader
public boolean shouldAddHostHeader(Method method)
- 
 
decorateRequest
public GeneratedHttpRequest<T> decorateRequest(GeneratedHttpRequest<T> request)
                                        throws NegativeArraySizeException,
                                               ExecutionException
- 
- Throws:
- NegativeArraySizeException
- ExecutionException
 
indexWithOnlyOneAnnotation
public static Map<Integer,Set<Annotation>> indexWithOnlyOneAnnotation(Method method,
                                                                      String description,
                                                                      com.google.common.cache.Cache<Method,com.google.common.cache.Cache<Integer,Set<Annotation>>> toRefine)
                                                               throws ExecutionException
- 
- Throws:
- ExecutionException
 
buildHeaders
public com.google.common.collect.Multimap<String,String> buildHeaders(Collection<Map.Entry<String,String>> tokenValues,
                                                                      Method method,
                                                                      Object... args)
                                                               throws ExecutionException
- 
- Throws:
- ExecutionException
 
addHeaderIfAnnotationPresentOnMethod
public void addHeaderIfAnnotationPresentOnMethod(com.google.common.collect.Multimap<String,String> headers,
                                                 Method method,
                                                 Collection<Map.Entry<String,String>> tokenValues)
- 
 
findHttpRequestInArgs
public static HttpRequest findHttpRequestInArgs(Object[] args)
- 
 
findPayloadInArgs
public static Payload findPayloadInArgs(Object[] args)
- 
 
Copyright © 2009-2011 jclouds. All Rights Reserved.