1
|
/**
|
2
|
* Copyright (C) 2018 EDIT
|
3
|
* 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 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.remote.json.processor.value;
|
10
|
|
11
|
import net.sf.json.JSONNull;
|
12
|
import net.sf.json.processors.DefaultDefaultValueProcessor;
|
13
|
|
14
|
/**
|
15
|
* Overrides the default implementation in json-lib to preserve null values of all numbers.
|
16
|
*
|
17
|
* See https://dev.e-taxonomy.eu/redmine/issues/7578
|
18
|
*
|
19
|
* @author a.kohlbecker
|
20
|
* @since Jul 23, 2018
|
21
|
*
|
22
|
*/
|
23
|
public class CdmDefaultValueProcessor extends DefaultDefaultValueProcessor {
|
24
|
|
25
|
@Override
|
26
|
public Object getDefaultValue( Class type ) {
|
27
|
if(Number.class.isAssignableFrom(type)){
|
28
|
return JSONNull.getInstance();
|
29
|
} else {
|
30
|
return super.getDefaultValue(type);
|
31
|
}
|
32
|
}
|
33
|
|
34
|
}
|