[teiid-commits] teiid SVN: r1070 - in trunk/common-core/src/main: java/com/metamatrix/common/types/basic and 1 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Fri Jun 19 13:25:58 EDT 2009
Author: shawkins
Date: 2009-06-19 13:25:58 -0400 (Fri, 19 Jun 2009)
New Revision: 1070
Added:
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
Removed:
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToLongTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToShortTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBooleanTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToByteTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToDoubleTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToFloatTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToLongTransform.java
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigIntegerTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigDecimalTransform.java
trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigIntegerTransform.java
trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
Log:
TEIID-689 changed numeric conversions to use valueof. also consolidated many of the transforms.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/DataTypeManager.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -22,16 +22,11 @@
package com.metamatrix.common.types;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.sql.Blob;
import java.sql.Clob;
-//## JDBC4.0-begin ##
import java.sql.SQLXML;
-//## JDBC4.0-end ##
-
-/*## JDBC3.0-JDK1.5-begin ##
-import com.metamatrix.core.jdbc.SQLXML;
-## JDBC3.0-JDK1.5-end ##*/
-
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collections;
@@ -47,7 +42,15 @@
import javax.xml.transform.stream.StreamSource;
import com.metamatrix.common.types.basic.AnyToObjectTransform;
+import com.metamatrix.common.types.basic.BooleanToNumberTransform;
import com.metamatrix.common.types.basic.NullToAnyTransform;
+import com.metamatrix.common.types.basic.NumberToBooleanTransform;
+import com.metamatrix.common.types.basic.NumberToByteTransform;
+import com.metamatrix.common.types.basic.NumberToDoubleTransform;
+import com.metamatrix.common.types.basic.NumberToFloatTransform;
+import com.metamatrix.common.types.basic.NumberToIntegerTransform;
+import com.metamatrix.common.types.basic.NumberToLongTransform;
+import com.metamatrix.common.types.basic.NumberToShortTransform;
import com.metamatrix.common.types.basic.ObjectToAnyTransform;
import com.metamatrix.core.CorePlugin;
import com.metamatrix.core.ErrorMessageKeys;
@@ -571,58 +574,56 @@
static void loadBasicTransforms() {
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.BigDecimalToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(BigDecimal.valueOf(1), BigDecimal.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.BIG_DECIMAL));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.BIG_DECIMAL, true));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.BIG_DECIMAL, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigDecimalToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.BigDecimalToStringTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.BigIntegerToBigDecimalTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(BigInteger.valueOf(1), BigInteger.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.BIG_INTEGER));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.BIG_INTEGER, true));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.BIG_INTEGER, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BigIntegerToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.BigIntegerToStringTransform());
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToBigDecimalTransform());
+ .addTransform(new BooleanToNumberTransform(BigDecimal.valueOf(1), BigDecimal.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToBigIntegerTransform());
+ .addTransform(new BooleanToNumberTransform(BigInteger.valueOf(1), BigInteger.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToByteTransform());
+ .addTransform(new BooleanToNumberTransform(Double.valueOf(1), Double.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToDoubleTransform());
+ .addTransform(new BooleanToNumberTransform(Float.valueOf(1), Float.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToFloatTransform());
+ .addTransform(new BooleanToNumberTransform(Long.valueOf(1), Long.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToIntegerTransform());
+ .addTransform(new BooleanToNumberTransform(Integer.valueOf(1), Integer.valueOf(0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToLongTransform());
+ .addTransform(new BooleanToNumberTransform(Short.valueOf((short)1), Short.valueOf((short)0)));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.BooleanToShortTransform());
+ .addTransform(new BooleanToNumberTransform(Byte.valueOf((byte)1), Byte.valueOf((byte)0)));
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.BooleanToStringTransform());
@@ -630,19 +631,18 @@
.addTransform(new com.metamatrix.common.types.basic.ByteToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.ByteToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Byte.valueOf((byte)1), Byte.valueOf((byte)0)));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.BYTE, false));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.BYTE, false));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ByteToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.ByteToStringTransform());
DataTypeManager
@@ -660,95 +660,90 @@
.addTransform(new com.metamatrix.common.types.basic.DoubleToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.DoubleToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Double.valueOf(1), Double.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.DOUBLE));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.DOUBLE, true));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.DOUBLE, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.DoubleToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.DoubleToStringTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.FloatToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.FloatToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Float.valueOf(1), Float.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.FLOAT));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.FLOAT, false));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.FLOAT, true));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.FLOAT, true));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.FLOAT, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.FloatToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.FloatToStringTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.IntegerToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.IntegerToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Integer.valueOf(1), Integer.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.INTEGER));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.INTEGER, false));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.INTEGER, false));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.INTEGER, false));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.INTEGER, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToLongTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.IntegerToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.IntegerToStringTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.LongToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.LongToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Long.valueOf(1), Long.valueOf(0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.LONG));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.LONG, true));
+ DataTypeManager.addTransform(new NumberToShortTransform(
+ DefaultDataClasses.LONG, true));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.LongToShortTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.LongToStringTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.ShortToBigDecimalTransform());
DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.ShortToBigIntegerTransform());
+ DataTypeManager.addTransform(new NumberToBooleanTransform(Short.valueOf((short)1), Short.valueOf((short)0)));
+ DataTypeManager.addTransform(new NumberToByteTransform(
+ DefaultDataClasses.SHORT));
+ DataTypeManager.addTransform(new NumberToDoubleTransform(
+ DefaultDataClasses.SHORT, false));
+ DataTypeManager.addTransform(new NumberToFloatTransform(
+ DefaultDataClasses.SHORT, false));
+ DataTypeManager.addTransform(new NumberToIntegerTransform(
+ DefaultDataClasses.SHORT, false));
+ DataTypeManager.addTransform(new NumberToLongTransform(
+ DefaultDataClasses.SHORT, false));
DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToByteTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToBooleanTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToDoubleTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToFloatTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToIntegerTransform());
- DataTypeManager
- .addTransform(new com.metamatrix.common.types.basic.ShortToLongTransform());
- DataTypeManager
.addTransform(new com.metamatrix.common.types.basic.ShortToStringTransform());
DataTypeManager
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class BigDecimalToBooleanTransform extends AbstractTransform {
-
- private static final BigDecimal FALSE = new BigDecimal("0"); //$NON-NLS-1$
- private static final BigDecimal TRUE = new BigDecimal("1"); //$NON-NLS-1$
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0007,CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0007, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte((byte) ((BigDecimal) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((BigDecimal) value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((BigDecimal) value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((BigDecimal) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((BigDecimal) value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigDecimalToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigDecimalToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short((short) ((BigDecimal) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigDecimal.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class BigIntegerToBooleanTransform extends AbstractTransform {
-
- private static final BigInteger FALSE = new BigInteger("0"); //$NON-NLS-1$
- private static final BigInteger TRUE = new BigInteger("1"); //$NON-NLS-1$
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0008,CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0008, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte((byte) ((BigInteger) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((BigInteger) value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((BigInteger) value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((BigInteger) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((BigInteger) value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BigIntegerToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BigIntegerToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short((short) ((BigInteger) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return BigInteger.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigDecimal;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToBigDecimalTransform extends AbstractTransform {
-
- private static final BigDecimal FALSE = new BigDecimal("0"); //$NON-NLS-1$
- private static final BigDecimal TRUE = new BigDecimal("1"); //$NON-NLS-1$
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return BigDecimal.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToBigIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import java.math.BigInteger;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToBigIntegerTransform extends AbstractTransform {
-
- private static final BigInteger FALSE = new BigInteger("0"); //$NON-NLS-1$
- private static final BigInteger TRUE = new BigInteger("1"); //$NON-NLS-1$
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return BigInteger.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToByteTransform extends AbstractTransform {
-
- private static final Byte FALSE = new Byte((byte)0);
- private static final Byte TRUE = new Byte((byte)1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToDoubleTransform extends AbstractTransform {
-
- private static final Double FALSE = new Double(0);
- private static final Double TRUE = new Double(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToFloatTransform extends AbstractTransform {
-
- private static final Float FALSE = new Float(0);
- private static final Float TRUE = new Float(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToIntegerTransform extends AbstractTransform {
-
- private static final Integer FALSE = new Integer(0);
- private static final Integer TRUE = new Integer(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToLongTransform extends AbstractTransform {
-
- private static final Long FALSE = new Long(0);
- private static final Long TRUE = new Long(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
-}
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class BooleanToNumberTransform extends AbstractTransform {
+
+ private Object trueVal;
+ private Object falseVal;
+ private Class<?> targetType;
+
+ public BooleanToNumberTransform(Object trueVal, Object falseVal) {
+ this.trueVal = trueVal;
+ this.falseVal = falseVal;
+ this.targetType = trueVal.getClass();
+ }
+
+ @Override
+ public Class getSourceType() {
+ return DataTypeManager.DefaultDataClasses.BOOLEAN;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return targetType;
+ }
+
+ @Override
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return value.equals(Boolean.TRUE)?trueVal:falseVal;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToNumberTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/BooleanToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class BooleanToShortTransform extends AbstractTransform {
-
- private static final Short FALSE = new Short((short)0);
- private static final Short TRUE = new Short((short)1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(Boolean.FALSE)) {
- return FALSE;
- }
- return TRUE;
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Boolean.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigDecimal(((Byte) value).toString());
+ return BigDecimal.valueOf((Byte) value);
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBigIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigInteger("" + value); //$NON-NLS-1$
+ return BigInteger.valueOf((Byte)value);
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class ByteToBooleanTransform extends AbstractTransform {
-
- private static final Byte FALSE = new Byte((byte)0);
- private static final Byte TRUE = new Byte((byte)1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0009, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0009, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ByteToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((Byte) value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ByteToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((Byte) value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ByteToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((Byte) value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ByteToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((Byte) value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ByteToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ByteToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short(((Byte) value).shortValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Byte.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,11 +42,7 @@
return value;
}
- // case 3089 -- issue with converting 7.05 from double to bigdecimal
- // loss of precision to 7.04999999999999982236431605997495353221893310546875
- // to fix unexpected loss of precision see sun java doc
-// http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal(double)
- return new BigDecimal(((Double)value).toString());
+ return BigDecimal.valueOf((Double)value);
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class DoubleToBooleanTransform extends AbstractTransform {
-
- private static final Double FALSE = new Double(0);
- private static final Double TRUE = new Double(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0010, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0010, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class DoubleToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte(((Double)value).byteValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class DoubleToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((Double)value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class DoubleToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((Double)value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class DoubleToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((Double)value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/DoubleToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class DoubleToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short(((Double)value).shortValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Double.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigDecimal(((Float)value).toString());
+ return BigDecimal.valueOf((Float)value);
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-
-public class FloatToBooleanTransform extends AbstractTransform {
-
- private static final Float FALSE = new Float(0);
- private static final Float TRUE = new Float(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(CorePlugin.Util.getString("FloatToBooleanTransform.Failed_transform")); //$NON-NLS-1$
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class FloatToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte(((Float)value).byteValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class FloatToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((Float)value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class FloatToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((Float)value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class FloatToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((Float)value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/FloatToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class FloatToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short(((Float)value).shortValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Float.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigDecimal(((Integer)value).toString());
+ return BigDecimal.valueOf((Integer)value);
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBigIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigInteger("" + value); //$NON-NLS-1$
+ return new BigInteger(String.valueOf(value));
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class IntegerToBooleanTransform extends AbstractTransform {
-
- private static final Integer FALSE = new Integer(0);
- private static final Integer TRUE = new Integer(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0011, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0011, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class IntegerToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte(((Integer)value).byteValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class IntegerToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((Integer)value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class IntegerToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((Integer)value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
- @Override
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class IntegerToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((Integer)value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/IntegerToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class IntegerToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short(((Integer)value).shortValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Integer.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigDecimal(((Long)value).toString());
+ return new BigDecimal((Long)value);
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBigIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigInteger("" + value); //$NON-NLS-1$
+ return new BigInteger(String.valueOf(value));
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class LongToBooleanTransform extends AbstractTransform {
-
- private static final Long FALSE = new Long(0);
- private static final Long TRUE = new Long(1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0012, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0012, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class LongToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte(((Long)value).byteValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class LongToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((Long)value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
- @Override
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class LongToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((Long)value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class LongToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((Long)value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToShortTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/LongToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class LongToShortTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Short(((Long)value).shortValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Long.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Short.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+import com.metamatrix.core.CorePlugin;
+import com.metamatrix.core.ErrorMessageKeys;
+
+public class NumberToBooleanTransform extends AbstractTransform {
+
+ private Object trueVal;
+ private Object falseVal;
+ private Class<?> sourceType;
+
+ public NumberToBooleanTransform(Object trueVal, Object falseVal) {
+ this.trueVal = trueVal;
+ this.falseVal = falseVal;
+ this.sourceType = trueVal.getClass();
+ }
+
+ @Override
+ public Class getSourceType() {
+ return sourceType;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return DataTypeManager.DefaultDataClasses.BOOLEAN;
+ }
+
+ @Override
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ if (value.equals(trueVal)) {
+ return Boolean.TRUE;
+ }
+ if (value.equals(falseVal)) {
+ return Boolean.FALSE;
+ }
+ throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0013, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0013, sourceType.getSimpleName(), value));
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToBooleanTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToByteTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+
+ public NumberToByteTransform(Class<?> sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Byte.valueOf(((Number)value).byteValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.BYTE;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return true;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToByteTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToDoubleTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+ private boolean isNarrowing;
+
+ public NumberToDoubleTransform(Class<?> sourceType, boolean isNarrowing) {
+ this.sourceType = sourceType;
+ this.isNarrowing = isNarrowing;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Double.valueOf(((Number)value).doubleValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.DOUBLE;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToDoubleTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToFloatTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+ private boolean isNarrowing;
+
+ public NumberToFloatTransform(Class<?> sourceType, boolean isNarrowing) {
+ this.sourceType = sourceType;
+ this.isNarrowing = isNarrowing;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Float.valueOf(((Number)value).floatValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.FLOAT;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToFloatTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToIntegerTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+ private boolean isNarrowing;
+
+ public NumberToIntegerTransform(Class<?> sourceType, boolean isNarrowing) {
+ this.sourceType = sourceType;
+ this.isNarrowing = isNarrowing;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Integer.valueOf(((Number)value).intValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.INTEGER;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToIntegerTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToLongTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+ private boolean isNarrowing;
+
+ public NumberToLongTransform(Class<?> sourceType, boolean isNarrowing) {
+ this.sourceType = sourceType;
+ this.isNarrowing = isNarrowing;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Long.valueOf(((Number)value).longValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.LONG;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToLongTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java (rev 0)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package com.metamatrix.common.types.basic;
+
+import com.metamatrix.common.types.AbstractTransform;
+import com.metamatrix.common.types.DataTypeManager;
+import com.metamatrix.common.types.TransformationException;
+
+public class NumberToShortTransform extends AbstractTransform {
+
+ private Class<?> sourceType;
+ private boolean isNarrowing;
+
+ public NumberToShortTransform(Class<?> sourceType, boolean isNarrowing) {
+ this.sourceType = sourceType;
+ this.isNarrowing = isNarrowing;
+ }
+
+ @Override
+ public Class<?> getSourceType() {
+ return sourceType;
+ }
+
+ /**
+ * This method transforms a value of the source type into a value
+ * of the target type.
+ * @param value Incoming value of source type
+ * @return Outgoing value of target type
+ * @throws TransformationException if value is an incorrect input type or
+ * the transformation fails
+ */
+ public Object transform(Object value) throws TransformationException {
+ if (value == null) {
+ return null;
+ }
+ return Short.valueOf(((Number)value).shortValue());
+ }
+
+ /**
+ * Type of the outgoing value.
+ * @return Target type
+ */
+ public Class<?> getTargetType() {
+ return DataTypeManager.DefaultDataClasses.SHORT;
+ }
+
+ @Override
+ public boolean isNarrowing() {
+ return isNarrowing;
+ }
+
+}
Property changes on: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/NumberToShortTransform.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigDecimalTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigDecimalTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigDecimalTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigDecimal(((Short)value).toString());
+ return new BigDecimal((Short)value);
}
/**
Modified: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBigIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -42,7 +42,7 @@
return value;
}
- return new BigInteger("" + value); //$NON-NLS-1$
+ return new BigInteger(String.valueOf(value));
}
/**
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBooleanTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBooleanTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToBooleanTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-import com.metamatrix.core.CorePlugin;
-import com.metamatrix.core.ErrorMessageKeys;
-
-public class ShortToBooleanTransform extends AbstractTransform {
-
- private static final Short FALSE = new Short((short)0);
- private static final Short TRUE = new Short((short)1);
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- if(value.equals(FALSE)) {
- return Boolean.FALSE;
- } else if(value.equals(TRUE)) {
- return Boolean.TRUE;
- } else {
- throw new TransformationException(ErrorMessageKeys.TYPES_ERR_0013, CorePlugin.Util.getString(ErrorMessageKeys.TYPES_ERR_0013, value));
- }
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Boolean.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToByteTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToByteTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToByteTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ShortToByteTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Byte(((Short)value).byteValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Byte.class;
- }
-
- /**
- * Flag if the transformation from source to target is
- * a narrowing transformation that may lose information.
- * @return True - this transformation is narrowing
- */
- public boolean isNarrowing() {
- return true;
- }
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToDoubleTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToDoubleTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToDoubleTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ShortToDoubleTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Double(((Short)value).doubleValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Double.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToFloatTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToFloatTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToFloatTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ShortToFloatTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Float(((Short)value).floatValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Float.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToIntegerTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToIntegerTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToIntegerTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ShortToIntegerTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Integer(((Short)value).intValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Integer.class;
- }
-
-}
Deleted: trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToLongTransform.java
===================================================================
--- trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToLongTransform.java 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/java/com/metamatrix/common/types/basic/ShortToLongTransform.java 2009-06-19 17:25:58 UTC (rev 1070)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.types.basic;
-
-import com.metamatrix.common.types.AbstractTransform;
-import com.metamatrix.common.types.TransformationException;
-
-public class ShortToLongTransform extends AbstractTransform {
-
- /**
- * This method transforms a value of the source type into a value
- * of the target type.
- * @param value Incoming value of source type
- * @return Outgoing value of target type
- * @throws TransformationException if value is an incorrect input type or
- * the transformation fails
- */
- public Object transform(Object value) throws TransformationException {
- if(value == null) {
- return value;
- }
-
- return new Long(((Short)value).longValue());
- }
-
- /**
- * Type of the incoming value.
- * @return Source type
- */
- public Class getSourceType() {
- return Short.class;
- }
-
- /**
- * Type of the outgoing value.
- * @return Target type
- */
- public Class getTargetType() {
- return Long.class;
- }
-
-}
Modified: trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties
===================================================================
--- trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-06-19 14:18:15 UTC (rev 1069)
+++ trunk/common-core/src/main/resources/com/metamatrix/core/i18n.properties 2009-06-19 17:25:58 UTC (rev 1070)
@@ -348,13 +348,7 @@
ERR.003.029.0004=Transform cannot be null.
ERR.003.029.0005=Transform source name cannot be null: {0}
ERR.003.029.0006=Transform target name cannot be null: {0}
-ERR.003.029.0007=Failed to transform BigDecimal to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0008=Failed to transform BigInteger to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0009=Failed to transform Byte to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0010=Failed to transform Double to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0011=Failed to transform Integer to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0012=Failed to transform Long to Boolean. Expected 0 or 1 for {0}
-ERR.003.029.0013=Failed to transform Short to Boolean. Expected 0 or 1 for {0}
+ERR.003.029.0013=Failed to transform {0} to Boolean. Expected 0 or 1 for {1}
ERR.003.029.0014=Invalid BigDecimal format in String: {0}
ERR.003.029.0015=Invalid BigInteger format in String: {0}
ERR.003.029.0016=Invalid Byte format in String: {0}
More information about the teiid-commits
mailing list