at.ac.tuwien.infosys.sm4all.copal.rest.provider
Class XMLReader<T>

java.lang.Object
  extended by at.ac.tuwien.infosys.sm4all.copal.rest.provider.XMLReader<T>
Type Parameters:
T - the type of read value.
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<T>
Direct Known Subclasses:
XMLContextEventTypeReader, XMLEventReader, XMLProcessedEventQueryReader, XMLRESTfulListenerReader, XMLRESTfulPublisherReader

@Provider
public abstract class XMLReader<T>
extends java.lang.Object
implements javax.ws.rs.ext.MessageBodyReader<T>

An abstract MessageBodyReader that reads an instance of a Class from an application/xml InputStream.

Author:
sanjin

Constructor Summary
protected XMLReader(java.lang.Class<T> type)
          Creates instance of MessageBodyReader that reads an instance of specified Class from an application/xml InputStream.
 
Method Summary
 boolean isReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
           
 T readFrom(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream input)
           
protected abstract  T unmarshal(org.w3c.dom.Element element)
          Unmarshal a value from specified Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReader

protected XMLReader(java.lang.Class<T> type)
Creates instance of MessageBodyReader that reads an instance of specified Class from an application/xml InputStream.

Parameters:
type - the Class of instances that are read.
Method Detail

isReadable

public boolean isReadable(java.lang.Class<?> type,
                          java.lang.reflect.Type genericType,
                          java.lang.annotation.Annotation[] annotations,
                          javax.ws.rs.core.MediaType mediaType)
Specified by:
isReadable in interface javax.ws.rs.ext.MessageBodyReader<T>

readFrom

public T readFrom(java.lang.Class<T> type,
                  java.lang.reflect.Type genericType,
                  java.lang.annotation.Annotation[] annotations,
                  javax.ws.rs.core.MediaType mediaType,
                  javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
                  java.io.InputStream input)
           throws java.io.IOException,
                  javax.ws.rs.WebApplicationException
Specified by:
readFrom in interface javax.ws.rs.ext.MessageBodyReader<T>
Throws:
java.io.IOException
javax.ws.rs.WebApplicationException

unmarshal

protected abstract T unmarshal(org.w3c.dom.Element element)
                        throws FailedUnmarshallingException
Unmarshal a value from specified Element.

Parameters:
element - the Element used for unmarshalling.
Returns:
value the unmarshaled value.
Throws:
FailedUnmarshallingException - if unmarshalling was unsuccessful.


Copyright © 2010 Distributed Systems Group, Vienna University of Technology. All Rights Reserved.