Project

General

Profile

Download (1.05 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2009 EDIT European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 * 
6
 * The contents of this file are subject to the Mozilla Public License Version
7
 * 1.1 See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

    
10
package eu.etaxonomy.cdm.remote.json.processor;
11

    
12
import java.util.UUID;
13

    
14
import net.sf.json.JsonConfig;
15
import net.sf.json.processors.JsonValueProcessor;
16

    
17
import org.apache.log4j.Logger;
18

    
19
public class UUIDJSONValueProcessor implements JsonValueProcessor {
20
	
21
	private static final Logger logger = Logger.getLogger(UUIDJSONValueProcessor.class);
22

    
23
	public Object processArrayValue(Object obj, JsonConfig jsonConfig) {
24
		logger.debug("Processing UUID");
25
		if(obj == null){
26
			return "";
27
		}
28
		UUID uuid = (UUID) obj;
29
		return uuid.toString();
30
	}
31

    
32
	public Object processObjectValue(String key, Object obj,
33
			JsonConfig jsonConfig) {
34
		logger.debug("Processing UUID");
35
		if(obj == null){
36
			return "";
37
		}
38
		UUID uuid = (UUID) obj;
39
		return uuid.toString();
40
	};
41

    
42
}
(24-24/24)