org.wicketstuff.rest.contenthandling.serialdeserial
Class MultiFormatSerialDeserial

java.lang.Object
  extended by org.wicketstuff.rest.contenthandling.serialdeserial.MultiFormatSerialDeserial
All Implemented Interfaces:
IWebSerialDeserial

public class MultiFormatSerialDeserial
extends Object
implements IWebSerialDeserial

Object serializer/deserializer that supports multiple formats.

Author:
andrea del bene

Constructor Summary
MultiFormatSerialDeserial()
           
 
Method Summary
 boolean isMimeTypeSupported(String mimeType)
          Check if a given MIME type is handled.
 void objectToResponse(Object targetObject, WebResponse response, String mimeType)
          Write the object in input to the response converting it to a given MIME type.
 void registerSerDeser(IWebSerialDeserial serialDeserial, String mimeType)
          Register a new serial/deserial for the given MIME type.
<T> T
requestToObject(WebRequest request, Class<T> targetClass, String mimeType)
          Extract an instance of argClass form the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiFormatSerialDeserial

public MultiFormatSerialDeserial()
Method Detail

objectToResponse

public void objectToResponse(Object targetObject,
                             WebResponse response,
                             String mimeType)
Description copied from interface: IWebSerialDeserial
Write the object in input to the response converting it to a given MIME type.

Specified by:
objectToResponse in interface IWebSerialDeserial
Parameters:
targetObject - the object instance to serialize to string.
response - the response object.
mimeType - the MIME type of the response.

requestToObject

public <T> T requestToObject(WebRequest request,
                             Class<T> targetClass,
                             String mimeType)
Description copied from interface: IWebSerialDeserial
Extract an instance of argClass form the request.

Specified by:
requestToObject in interface IWebSerialDeserial
Parameters:
request - the request object.
targetClass - the type of the object we want to extract.
mimeType - the MIME type of the request.
Returns:
the object extracted from the request.

registerSerDeser

public void registerSerDeser(IWebSerialDeserial serialDeserial,
                             String mimeType)
Register a new serial/deserial for the given MIME type.

Parameters:
serialDeserial - the serial/deserial to use with the given MIME type.
mimeType - the MIME type we want to handle with the given serial/deserial.

isMimeTypeSupported

public boolean isMimeTypeSupported(String mimeType)
Description copied from interface: IWebSerialDeserial
Check if a given MIME type is handled.

Specified by:
isMimeTypeSupported in interface IWebSerialDeserial
Parameters:
mimeType - the MIME type we want to check.
Returns:
true if the MIME type is supported, false otherwise.


Copyright © 2013. All Rights Reserved.