Project

General

Profile

« Previous | Next » 

Revision 56104

using jackson to serialise dedup configurations

View differences:

DedupConfigurationOrchestration.java
1 1
package eu.dnetlib.msro.workflows.dedup.conf;
2 2

  
3
import java.io.IOException;
3 4
import java.util.Queue;
4 5

  
5 6
import com.google.gson.Gson;
6 7
import com.google.gson.GsonBuilder;
7 8

  
8 9
import eu.dnetlib.pace.config.DedupConfig;
10
import eu.dnetlib.pace.util.PaceException;
11
import org.codehaus.jackson.map.ObjectMapper;
9 12

  
10 13
/**
11 14
 * The Class DedupConfigurationOrchestration.
......
87 90
	 * @return the dedup configuration orchestration
88 91
	 */
89 92
	public static DedupConfigurationOrchestration fromJSON(final String json) {
90
		return new Gson().fromJson(json, DedupConfigurationOrchestration.class);
93
		try {
94
			return new ObjectMapper().readValue(json, DedupConfigurationOrchestration.class);
95
		} catch (IOException e) {
96
			throw new PaceException("unable to deserialise configuration", e);
97
		}
91 98
	}
92 99

  
93 100
	/*
......
97 104
	 */
98 105
	@Override
99 106
	public String toString() {
100
		return new GsonBuilder().setPrettyPrinting().create().toJson(this);
107
		try {
108
			return new ObjectMapper().writeValueAsString(this);
109
		} catch (IOException e) {
110
			throw new PaceException("unable to serialise configuration", e);
111
		}
101 112
	}
102 113

  
103 114
}

Also available in: Unified diff