01: /*
02: * Copyright 2005-2007 Noelios Consulting.
03: *
04: * The contents of this file are subject to the terms of the Common Development
05: * and Distribution License (the "License"). You may not use this file except in
06: * compliance with the License.
07: *
08: * You can obtain a copy of the license at
09: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
10: * language governing permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL HEADER in each file and
13: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
14: * applicable, add the following below this CDDL HEADER, with the fields
15: * enclosed by brackets "[]" replaced with your own identifying information:
16: * Portions Copyright [yyyy] [name of copyright owner]
17: */
18:
19: package org.restlet.service;
20:
21: import org.restlet.resource.Representation;
22:
23: /**
24: * Service converting message entities into higher-level objects. As the default
25: * implementation doesn't do any convertion by default, you have to subclass it
26: * and update the Application's "converterService" property with your own
27: * instance. Once this done, any Restlet or Resource that is part of this
28: * application can easily convert from representations to objects and the other
29: * way around. You just have to use the getEntityAsObject() method to convert a
30: * message's representation into a higher-level object and the setEntity(Object)
31: * method to convert a higher-level object into a representation.
32: *
33: * @see org.restlet.data.Message#getEntityAsObject()
34: * @see org.restlet.data.Message#setEntity(Object)
35: * @author Jerome Louvel (contact@noelios.com)
36: */
37: public class ConverterService {
38: /**
39: * Converts a representation into a higher-level object. Returns null by
40: * default.
41: *
42: * @param representation
43: * The representation to convert.
44: * @return A higher-level object.
45: */
46: public Object toObject(Representation representation) {
47: return null;
48: }
49:
50: /**
51: * Converts a higher-level object into a representation. Returns null by
52: * default.
53: *
54: * @param object
55: * The higher-level object.
56: * @return A representation.
57: */
58: public Representation toRepresentation(Object object) {
59: return null;
60: }
61:
62: }
|