org.restlet.service
Class ConverterService

java.lang.Object
  extended by org.restlet.service.ConverterService

public class ConverterService
extends Object

Service converting message entities into higher-level objects. As the default implementation doesn't do any convertion by default, you have to subclass it and update the Application's "converterService" property with your own instance. Once this done, any Restlet or Resource that is part of this application can easily convert from representations to objects and the other way around. You just have to use the getEntityAsObject() method to convert a message's representation into a higher-level object and the setEntity(Object) method to convert a higher-level object into a representation.

Author:
Jerome Louvel (contact@noelios.com)
See Also:
Message.getEntityAsObject(), Message.setEntity(Object)

Constructor Summary
ConverterService()
           
 
Method Summary
 Object toObject(Representation representation)
          Converts a representation into a higher-level object.
 Representation toRepresentation(Object object)
          Converts a higher-level object into a representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterService

public ConverterService()
Method Detail

toObject

public Object toObject(Representation representation)
Converts a representation into a higher-level object. Returns null by default.

Parameters:
representation - The representation to convert.
Returns:
A higher-level object.

toRepresentation

public Representation toRepresentation(Object object)
Converts a higher-level object into a representation. Returns null by default.

Parameters:
object - The higher-level object.
Returns:
A representation.


Copyright © 2005-2007 Noelios Consulting.