org.xwiki.annotation.rest.internal.representations
Class AbstractFormUrlEncodedAnnotationRequestReader<T extends AnnotationRequest>

java.lang.Object
  extended by org.xwiki.annotation.rest.internal.representations.AbstractFormUrlEncodedAnnotationRequestReader<T>
Type Parameters:
T - the type read from the url encoded form
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<T>, XWikiRestComponent
Direct Known Subclasses:
AbstractFormUrlEncodedAnnotationUpdateRequestReader, FormUrlEncodedAnnotationRequestReader

public abstract class AbstractFormUrlEncodedAnnotationRequestReader<T extends AnnotationRequest>
extends java.lang.Object
implements javax.ws.rs.ext.MessageBodyReader<T>, XWikiRestComponent

Partial implementation of a reader from form submits requests for annotation related types, to handle generic request reader code.

Since:
2.3M1
Version:
$Id$

Field Summary
protected static java.lang.String FILTER_FIELD_PREFIX
          The prefix of the parameters of the annotations filters.
protected static java.lang.String REQUESTED_FIELD
          The parameter name for a field requested to appear in the annotations stub.
 
Constructor Summary
AbstractFormUrlEncodedAnnotationRequestReader()
           
 
Method Summary
protected abstract  T getReadObjectInstance(ObjectFactory factory)
          Helper function to provide an instance of the read object from the object factory.
 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 entityStream)
          
protected  boolean saveField(T readObject, java.lang.String key, java.lang.String value, ObjectFactory objectFactory)
          Helper function to save a parameter in the read object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ws.rs.ext.MessageBodyReader
isReadable
 

Field Detail

REQUESTED_FIELD

protected static final java.lang.String REQUESTED_FIELD
The parameter name for a field requested to appear in the annotations stub.
Note: This can get problematic if a custom field of the annotation is called the same

See Also:
Constant Field Values

FILTER_FIELD_PREFIX

protected static final java.lang.String FILTER_FIELD_PREFIX
The prefix of the parameters of the annotations filters.
Note: This can get problematic if custom fields of the annotation are called the same

See Also:
Constant Field Values
Constructor Detail

AbstractFormUrlEncodedAnnotationRequestReader

public AbstractFormUrlEncodedAnnotationRequestReader()
Method Detail

getReadObjectInstance

protected abstract T getReadObjectInstance(ObjectFactory factory)
Helper function to provide an instance of the read object from the object factory.

Parameters:
factory - the object factory
Returns:
an instance of the read type T, as built by the object factory.

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 entityStream)
                                     throws java.io.IOException,
                                            javax.ws.rs.WebApplicationException

Specified by:
readFrom in interface javax.ws.rs.ext.MessageBodyReader<T extends AnnotationRequest>
Throws:
java.io.IOException
javax.ws.rs.WebApplicationException
See Also:
MessageBodyReader.readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream)

saveField

protected boolean saveField(T readObject,
                            java.lang.String key,
                            java.lang.String value,
                            ObjectFactory objectFactory)
Helper function to save a parameter in the read object. To implement in subclasses to provide type specific behaviour.

Parameters:
readObject - the request to fill with data
key - the key of the field
value - the value of the field
objectFactory - the objects factory to create the annotation fields
Returns:
true if the field was saved at this level, false otherwise


Copyright © 2004-2011 XWiki. All Rights Reserved.