Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
index 774d4588ae..45d407aa88 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
@@ -24,6 +24,8 @@ import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -164,6 +166,62 @@ public abstract class CDOTypeImpl implements CDOType
}
};
+ public static final CDOType BIG_DECIMAL = new CDOTypeImpl("BIG_DECIMAL", EcorePackage.EBIG_DECIMAL, true)
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeByteArray(null);
+ }
+ else
+ {
+ BigDecimal bigDecimal = (BigDecimal)value;
+ out.writeByteArray(bigDecimal.unscaledValue().toByteArray());
+ out.writeInt(bigDecimal.scale());
+ }
+ }
+
+ public Object readValue(CDODataInput in) throws IOException
+ {
+ byte[] array = in.readByteArray();
+ if (array == null)
+ {
+ return null;
+ }
+
+ BigInteger unscaled = new BigInteger(array);
+ int scale = in.readInt();
+ return new BigDecimal(unscaled, scale);
+ }
+ };
+
+ public static final CDOType BIG_INTEGER = new CDOTypeImpl("BIG_INTEGER", EcorePackage.EBIG_INTEGER, true)
+ {
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ if (value == null)
+ {
+ out.writeByteArray(null);
+ }
+ else
+ {
+ out.writeByteArray(((BigInteger)value).toByteArray());
+ }
+ }
+
+ public Object readValue(CDODataInput in) throws IOException
+ {
+ byte[] array = in.readByteArray();
+ if (array == null)
+ {
+ return null;
+ }
+
+ return new BigInteger(array);
+ }
+ };
+
public static final CDOType OBJECT = new CDOTypeImpl("OBJECT", EcorePackage.EOBJECT, true, CDOID.NULL)
{
public void writeValue(CDODataOutput out, Object value) throws IOException

Back to the top