@Singleton public class ParseXMLWithJAXB<T> extends Object implements com.google.common.base.Function<HttpResponse,T>
JAXBContext
works with Class
objects instead of Type
.
This could be a limitation if we are trying to parse typed collections of
objects. However, when using JAXB we expect to have well formed XML documents
with one single root element, so the objects to parse should not be
collections but objects that wrap collections of elements, and that should
work fine.
Modifier and Type | Field and Description |
---|---|
protected Logger |
logger |
protected com.google.inject.TypeLiteral<T> |
type |
protected XMLParser |
xml |
Constructor and Description |
---|
ParseXMLWithJAXB(XMLParser xml,
com.google.inject.TypeLiteral<T> type) |
Modifier and Type | Method and Description |
---|---|
T |
apply(HttpResponse from) |
T |
apply(InputStream stream) |
<V> V |
apply(InputStream stream,
Class<V> type) |
protected Logger logger
protected XMLParser xml
protected final com.google.inject.TypeLiteral<T> type
public T apply(HttpResponse from)
apply
in interface com.google.common.base.Function<HttpResponse,T>
public T apply(InputStream stream) throws IOException
IOException
public <V> V apply(InputStream stream, Class<V> type) throws IOException
IOException
Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.