diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/plugin.xml b/io/plugins/eu.esdihumboldt.hale.io.gml/plugin.xml index cb3df0dd0a..f1d4f52de3 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.gml/plugin.xml +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/plugin.xml @@ -1533,6 +1533,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/SimpleTypeUtil.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/SimpleTypeUtil.java index 32d403a186..dd1b61ff16 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/SimpleTypeUtil.java +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/SimpleTypeUtil.java @@ -29,6 +29,13 @@ import org.apache.xmlbeans.XmlAnySimpleType; import org.apache.xmlbeans.XmlDate; import org.apache.xmlbeans.XmlDateTime; +import org.apache.xmlbeans.XmlDecimal; +import org.apache.xmlbeans.XmlDouble; +import org.apache.xmlbeans.XmlFloat; +import org.apache.xmlbeans.XmlInt; +import org.apache.xmlbeans.XmlInteger; +import org.apache.xmlbeans.XmlLong; +import org.apache.xmlbeans.XmlShort; import org.apache.xmlbeans.XmlTime; import org.springframework.core.convert.ConversionException; import org.springframework.core.convert.ConversionService; @@ -62,6 +69,14 @@ public class SimpleTypeUtil { TYPE_MAP.put("dateTime", XmlDateTime.class); //$NON-NLS-1$ TYPE_MAP.put("date", XmlDate.class); //$NON-NLS-1$ TYPE_MAP.put("time", XmlTime.class); //$NON-NLS-1$ + + TYPE_MAP.put("int", XmlInt.class); //$NON-NLS-1$ + TYPE_MAP.put("integer", XmlInteger.class); //$NON-NLS-1$ + TYPE_MAP.put("short", XmlShort.class); //$NON-NLS-1$ + TYPE_MAP.put("float", XmlFloat.class); //$NON-NLS-1$ + TYPE_MAP.put("double", XmlDouble.class); //$NON-NLS-1$ + TYPE_MAP.put("long", XmlLong.class); //$NON-NLS-1$ + TYPE_MAP.put("decimal", XmlDecimal.class); //$NON-NLS-1$ } /** @@ -111,6 +126,7 @@ else if (simpleTypeValue instanceof XmlDateTime) { xmlDateTime.setGDateValue(gdate); } + // Numbers should be handled here if (simpleTypeValue != null) { return simpleTypeValue.getStringValue(); } diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigDecimalToXmlDecimal.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigDecimalToXmlDecimal.java new file mode 100644 index 0000000000..55fe904035 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigDecimalToXmlDecimal.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @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; + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigIntegerToXmlBigInteger.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigIntegerToXmlBigInteger.java new file mode 100644 index 0000000000..757ba998d7 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/BigIntegerToXmlBigInteger.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlInteger convert(BigInteger value) { + if (value == null) { + return null; + } + return XmlInteger.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/DoubleToXmlDouble.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/DoubleToXmlDouble.java new file mode 100644 index 0000000000..99f505b237 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/DoubleToXmlDouble.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlDouble convert(Double value) { + if (value == null) { + return null; + } + return XmlDouble.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/FloatToXmlFloat.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/FloatToXmlFloat.java new file mode 100644 index 0000000000..22f8ee8441 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/FloatToXmlFloat.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlFloat convert(Float value) { + if (value == null) { + return null; + } + return XmlFloat.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInt.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInt.java new file mode 100644 index 0000000000..798565745e --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInt.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlInt convert(Integer value) { + if (value == null) { + return null; + } + return XmlInt.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInteger.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInteger.java new file mode 100644 index 0000000000..bf73804e86 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/IntegerToXmlInteger.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlInteger convert(Integer value) { + if (value == null) { + return null; + } + return XmlInteger.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/LongToXmlLong.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/LongToXmlLong.java new file mode 100644 index 0000000000..e5f810fbfb --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/LongToXmlLong.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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 { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlLong convert(Long value) { + if (value == null) { + return null; + } + return XmlLong.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/ShortToXmlShort.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/ShortToXmlShort.java new file mode 100644 index 0000000000..755770afa9 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/ShortToXmlShort.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlDecimal; +import org.apache.xmlbeans.XmlShort; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:BigDecimal to {@link XmlDecimal} + */ +public class ShortToXmlShort implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public XmlShort convert(Short value) { + if (value == null) { + return null; + } + return XmlShort.Factory.newValue(value); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDecimalToBigDecimal.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDecimalToBigDecimal.java new file mode 100644 index 0000000000..c21d76f784 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDecimalToBigDecimal.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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:XmlDecimal to {@link BigDecimal} + */ +public class XmlDecimalToBigDecimal implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public BigDecimal convert(XmlDecimal value) { + if (value == null) { + return null; + } + return value.getBigDecimalValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDoubleToDouble.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDoubleToDouble.java new file mode 100644 index 0000000000..ef40b16562 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlDoubleToDouble.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlDouble; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlDouble to {@link Double} + */ +public class XmlDoubleToDouble implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Double convert(XmlDouble value) { + if (value == null) { + return null; + } + return value.getDoubleValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlFloatToFloat.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlFloatToFloat.java new file mode 100644 index 0000000000..2b170a971d --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlFloatToFloat.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlFloat; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlFloat to {@link Float} + */ +public class XmlFloatToFloat implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Float convert(XmlFloat value) { + if (value == null) { + return null; + } + return value.getFloatValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntToInteger.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntToInteger.java new file mode 100644 index 0000000000..116737dd6c --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntToInteger.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlInt; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlInteger to {@link Integer} + */ +public class XmlIntToInteger implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Integer convert(XmlInt value) { + if (value == null) { + return null; + } + return value.getBigIntegerValue().intValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToBigInteger.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToBigInteger.java new file mode 100644 index 0000000000..92099fc83c --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToBigInteger.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +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:XmlInteger to {@link BigInteger} + */ +public class XmlIntegerToBigInteger implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public BigInteger convert(XmlInteger value) { + if (value == null) { + return null; + } + return value.getBigIntegerValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToInteger.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToInteger.java new file mode 100644 index 0000000000..611952c48f --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlIntegerToInteger.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlInteger; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlInteger to {@link Integer} + */ +public class XmlIntegerToInteger implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Integer convert(XmlInteger value) { + if (value == null) { + return null; + } + return value.getBigIntegerValue().intValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlLongToLong.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlLongToLong.java new file mode 100644 index 0000000000..b58c02a443 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlLongToLong.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlLong; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlLong to {@link Long} + */ +public class XmlLongToLong implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Long convert(XmlLong value) { + if (value == null) { + return null; + } + return value.getLongValue(); + } + +} diff --git a/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlShortToShort.java b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlShortToShort.java new file mode 100644 index 0000000000..0bfe395bd2 --- /dev/null +++ b/io/plugins/eu.esdihumboldt.hale.io.gml/src/eu/esdihumboldt/hale/io/gml/internal/simpletype/converters/XmlShortToShort.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 wetransform GmbH + * + * 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 . + * + * Contributors: + * wetransform GmbH + */ + +package eu.esdihumboldt.hale.io.gml.internal.simpletype.converters; + +import org.apache.xmlbeans.XmlShort; +import org.geotools.xml.xsi.XSISimpleTypes.Decimal; +import org.springframework.core.convert.converter.Converter; + +/** + * Convert xs:XmlDecimal to {@link Decimal} + */ +public class XmlShortToShort implements Converter { + + /** + * @see Converter#convert(Object) + */ + @Override + public Short convert(XmlShort value) { + if (value == null) { + return null; + } + return value.getShortValue(); + } + +}