-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use appropriate methods to convert the numbers in XML
Conversion of the numbers using appropriate methods of each different type. ING-3965
- Loading branch information
1 parent
d56e083
commit f08c2bc
Showing
18 changed files
with
677 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...rc/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigDecimalToXmlDecimal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import java.math.BigDecimal; | ||
|
||
import org.apache.xmlbeans.XmlDecimal; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:BigDecimal to {@link XmlDecimal} | ||
*/ | ||
public class BigDecimalToXmlDecimal implements Converter<BigDecimal, XmlDecimal> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlDecimal convert(BigDecimal value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
|
||
// Convert BigDecimal to string | ||
String stringValue = value.toPlainString(); | ||
|
||
XmlDecimal xmlDecimalValue = XmlDecimal.Factory.newInstance(); | ||
xmlDecimalValue.setStringValue(stringValue); | ||
return xmlDecimalValue; | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigIntegerToXmlBigInteger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import java.math.BigInteger; | ||
|
||
import org.apache.xmlbeans.XmlInteger; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:BigInteger to {@link XmlInteger} | ||
*/ | ||
public class BigIntegerToXmlBigInteger implements Converter<BigInteger, XmlInteger> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlInteger convert(BigInteger value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlInteger.Factory.newValue(value); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/DoubleToXmlDouble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import org.apache.xmlbeans.XmlDouble; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:Double to {@link XmlDouble} | ||
*/ | ||
public class DoubleToXmlDouble implements Converter<Double, XmlDouble> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlDouble convert(Double value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlDouble.Factory.newValue(value); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...o.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/FloatToXmlFloat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* aFloat with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import org.apache.xmlbeans.XmlFloat; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:Float to {@link XmlFloat} | ||
*/ | ||
public class FloatToXmlFloat implements Converter<Float, XmlFloat> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlFloat convert(Float value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlFloat.Factory.newValue(value); | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...o.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import org.apache.xmlbeans.XmlInt; | ||
import org.apache.xmlbeans.XmlInteger; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:Int to {@link XmlInteger} | ||
*/ | ||
public class IntegerToXmlInt implements Converter<Integer, XmlInt> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlInt convert(Integer value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlInt.Factory.newValue(value); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...l/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInteger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import org.apache.xmlbeans.XmlInteger; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:Integer to {@link XmlInteger} | ||
*/ | ||
public class IntegerToXmlInteger implements Converter<Integer, XmlInteger> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlInteger convert(Integer value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlInteger.Factory.newValue(value); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
....io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/LongToXmlLong.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2012 Data Harmonisation Panel | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* HUMBOLDT EU Integrated Project #030962 | ||
* Data Harmonisation Panel <http://www.dhpanel.eu> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; | ||
|
||
import org.apache.xmlbeans.XmlLong; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
/** | ||
* Convert xs:Long to {@link XmlLong} | ||
*/ | ||
public class LongToXmlLong implements Converter<Long, XmlLong> { | ||
|
||
/** | ||
* @see Converter#convert(Object) | ||
*/ | ||
@Override | ||
public XmlLong convert(Long value) { | ||
if (value == null) { | ||
return null; | ||
} | ||
return XmlLong.Factory.newValue(value); | ||
} | ||
|
||
} |
Oops, something went wrong.