org.jclouds.http.functions
Class ParseJson<T>
java.lang.Object
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
Constructor Summary |
ParseJson(Json json,
com.google.inject.TypeLiteral<T> 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 |
logger
protected Logger logger
json
protected final Json json
type
protected final com.google.inject.TypeLiteral<T> type
ParseJson
@Inject
public ParseJson(Json json,
com.google.inject.TypeLiteral<T> type)
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.