Project

General

Profile

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

    
9
package eu.etaxonomy.cdm.remote.json.processor.value;
10

    
11
import java.util.UUID;
12

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

    
16
import org.apache.log4j.Logger;
17

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

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

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

    
41
}
(8-8/8)