commit | author | age
|
ca8e1e
|
1 |
/* |
U |
2 |
Transit - Remote procedure calls made simple |
|
3 |
Copyright (c) 2012 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
package de.uhilger.transit; |
|
20 |
|
|
21 |
|
|
22 |
import com.thoughtworks.xstream.XStream; |
|
23 |
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver; |
|
24 |
|
|
25 |
/** |
|
26 |
* Java-Objekte in die JavaScript Object Notation (JSON) |
|
27 |
* verwandeln und umgekehrt |
|
28 |
* |
|
29 |
* <p>Diese Klasse benoetigt die Java-Klassenbibliotheken |
42c48e
|
30 |
* <a href="http://xstream.codehaus.org/" target="_blank">XStream</a> |
U |
31 |
* und <a href="http://jettison.codehaus.org/" target="_blank">Jettison</a> |
ca8e1e
|
32 |
* im Classpath.</p> |
U |
33 |
* |
|
34 |
* @author Copyright (c) Ulrich Hilger, http://uhilger.de |
|
35 |
* @author Published under the terms and conditions of |
|
36 |
* the <a href="http://www.gnu.org/licenses/agpl-3.0" target="_blank">GNU Affero General Public License</a> |
|
37 |
* |
|
38 |
* @version 1, September 16, 2012 |
|
39 |
*/ |
|
40 |
public class JsonWandler extends AbstractWandler { |
|
41 |
|
|
42 |
/** Bezeichnerdes Formats, das dieser Wandler unterstuetzt */ |
|
43 |
public static final String FORMAT_JSON = "JSON"; |
|
44 |
|
|
45 |
protected XStream getXStream() { |
|
46 |
return new XStream(new JettisonMappedXmlDriver()); |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* Das Format ermitteln, das dieser Wandler verarbeitet |
|
51 |
* @return das Format, das dieser Wandler verarbeitet |
|
52 |
*/ |
|
53 |
@Override |
|
54 |
public String getFormat() { |
|
55 |
return FORMAT_JSON; |
|
56 |
} |
|
57 |
|
|
58 |
} |