org.jclouds.http.functions
Class ParseJson<T>

java.lang.Object
  extended by org.jclouds.http.functions.ParseJson<T>
All Implemented Interfaces:
com.google.common.base.Function<HttpResponse,T>
Direct Known Subclasses:
ParseObjectInfoListFromJsonResponse

@Singleton
public class ParseJson<T>
extends Object
implements com.google.common.base.Function<HttpResponse,T>

This object will parse the body of an HttpResponse and return the result of type back to the caller.

Author:
Adrian Cole

Field Summary
protected  Json json
           
protected  Logger logger
           
protected  com.google.inject.TypeLiteral<T> type
           
 
Constructor Summary
ParseJson(Json json, com.google.inject.TypeLiteral<T> type)
           
 
Method Summary
 T apply(HttpResponse from)
          parses the http response body to create a new <T>.
 T apply(InputStream stream)
           
<V> V
apply(InputStream stream, Type type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Field Detail

logger

protected Logger logger

json

protected final Json json

type

protected final com.google.inject.TypeLiteral<T> type
Constructor Detail

ParseJson

@Inject
public ParseJson(Json json,
                        com.google.inject.TypeLiteral<T> type)
Method Detail

apply

public T apply(HttpResponse from)
parses the http response body to create a new <T>.

Specified by:
apply in interface com.google.common.base.Function<HttpResponse,T>

apply

public T apply(InputStream stream)
        throws IOException
Throws:
IOException

apply

public <V> V apply(InputStream stream,
                   Type type)
        throws IOException
Throws:
IOException


Copyright © 2009-2012 jclouds. All Rights Reserved.