Revision f0b8034c
Added by Andreas Müller almost 2 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/value/PartialJSONValueProcessor.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.remote.json.processor.value; |
11 | 10 |
|
12 |
import net.sf.json.JsonConfig; |
|
13 |
import net.sf.json.processors.JsonValueProcessor; |
|
14 |
|
|
15 |
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger; |
|
11 |
import org.apache.logging.log4j.LogManager; |
|
12 |
import org.apache.logging.log4j.Logger; |
|
16 | 13 |
import org.joda.time.Partial; |
17 | 14 |
import org.joda.time.format.ISODateTimeFormat; |
18 | 15 |
|
19 | 16 |
import eu.etaxonomy.cdm.hibernate.PartialUserType; |
17 |
import net.sf.json.JsonConfig; |
|
18 |
import net.sf.json.processors.JsonValueProcessor; |
|
20 | 19 |
|
21 | 20 |
/** |
22 | 21 |
* Partial time as four digit year, two digit month of year, and two digit day of month (yyyy-MM-dd). |
22 |
* |
|
23 | 23 |
* @author a.kohlbecker |
24 | 24 |
* @since 20.01.2008 |
25 |
* @version 1.0 |
|
26 | 25 |
*/ |
27 | 26 |
public class PartialJSONValueProcessor implements JsonValueProcessor { |
28 |
private static Logger logger = LogManager.getLogger(PartialJSONValueProcessor.class); |
|
29 | 27 |
|
30 |
|
|
31 |
/* (non-Javadoc) |
|
32 |
* @see net.sf.json.processors.JsonValueProcessor#processArrayValue(java.lang.Object, net.sf.json.JsonConfig) |
|
33 |
*/ |
|
34 |
public Object processArrayValue(Object object, JsonConfig jsonConfig) { |
|
28 |
private static Logger logger = LogManager.getLogger(PartialJSONValueProcessor.class); |
|
29 |
|
|
30 |
@Override |
|
31 |
public Object processArrayValue(Object object, JsonConfig jsonConfig) { |
|
35 | 32 |
if(object == null){ |
36 | 33 |
return ""; |
37 | 34 |
} |
... | ... | |
42 | 39 |
return partial.toString(ISODateTimeFormat.date()); |
43 | 40 |
} |
44 | 41 |
|
45 |
/* (non-Javadoc) |
|
46 |
* @see net.sf.json.processors.JsonValueProcessor#processObjectValue(java.lang.String, java.lang.Object, net.sf.json.JsonConfig) |
|
47 |
*/ |
|
48 |
public Object processObjectValue(String key, Object object, JsonConfig jsonConfig) { |
|
42 |
@Override |
|
43 |
public Object processObjectValue(String key, Object object, JsonConfig jsonConfig) { |
|
49 | 44 |
if(object == null){ |
50 | 45 |
return ""; |
51 | 46 |
} |
Also available in: Unified diff
cleanup