Added javadoc to JAXB parser

This commit is contained in:
Ignasi Barrera 2011-10-25 11:18:29 +02:00 committed by Adrian Cole
parent 69163eb447
commit b90f74352f
2 changed files with 10 additions and 0 deletions

View File

@ -23,10 +23,12 @@ import static org.jclouds.http.HttpUtils.releasePayload;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Type;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import javax.xml.bind.JAXBContext;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
@ -40,6 +42,12 @@ import com.google.inject.TypeLiteral;
/** /**
* This object will parse the body of an HttpResponse and return the result of type <T> back to the * This object will parse the body of an HttpResponse and return the result of type <T> back to the
* caller. * caller.
* <p>
* {@link JAXBContext} works with {@link Class} objects instead of {@link 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.
* *
* @author Ignasi Barrera * @author Ignasi Barrera
*/ */

View File

@ -29,12 +29,14 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
import org.jclouds.http.functions.ParseXMLWithJAXB;
import org.jclouds.xml.XMLParser; import org.jclouds.xml.XMLParser;
/** /**
* Parses XML documents using JAXB. * Parses XML documents using JAXB.
* *
* @author Ignasi Barrera * @author Ignasi Barrera
* @see ParseXMLWithJAXB
*/ */
@Singleton @Singleton
public class JAXBParser implements XMLParser public class JAXBParser implements XMLParser