cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1358372 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/conf/ main/java/org/apache/cayenne/dba/ test/java/org/apache/cayenne/dba/
Date Fri, 06 Jul 2012 19:44:21 GMT
Author: aadamchik
Date: Fri Jul  6 19:44:20 2012
New Revision: 1358372

URL: http://svn.apache.org/viewvc?rev=1358372&view=rev
Log:
CAY-1718 Remove everything deprecated in 3.1

in progress

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/WebApplicationContextFilter.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java?rev=1358372&r1=1358371&r2=1358372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
Fri Jul  6 19:44:20 2012
@@ -445,37 +445,7 @@ public class TypesMapping {
         return sqlEnumJava.get(Integer.valueOf(type));
     }
 
-    /**
-     * Get the corresponding Java type by its java.sql.Types counterpart. Note that this
-     * method should be used as a last resort, with explicit mapping provided by user used
-     * as a first choice, as it can only guess how to map certain types, such as NUMERIC,
-     * etc.
-     * 
-     * @return Fully qualified Java type name or null if not found.
-     * @deprecated since 3.0. use getJavaBySqlType(int) instead. Not usable since "0" can
-     *             mean "undefined", not really zero.
-     */
-    @Deprecated
-    public static String getJavaBySqlType(int type, int length, int scale) {
-
-        // this does not always produce the correct result. See for instance CAY-1052 - PG
-        // drivers from 8.2 and newer decided that the scale of "0" means "undefined", not
-        // really zero.
-        if (type == Types.NUMERIC && scale == 0) { // SQL integer's max value is
2^31-1,
-                                                   // which has length of 10
-            if (length < 10) {
-                type = Types.INTEGER;
-            }
-            else if (length < 19) { // SQL's BIGINT max value is 2^63-1, which has length
-                                    // of 19
-                type = Types.BIGINT;
-            }
-
-        }
-
-        return sqlEnumJava.get(Integer.valueOf(type));
-    }
-
+ 
     protected Map<Integer, List<TypeInfo>> databaseTypes = new HashMap<Integer,
List<TypeInfo>>();
 
     public TypesMapping(DatabaseMetaData metaData) throws SQLException {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java?rev=1358372&r1=1358371&r2=1358372&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java
Fri Jul  6 19:44:20 2012
@@ -45,12 +45,14 @@ public class TypesMappingTest extends Se
         assertEquals(Types.BINARY, TypesMapping.getSqlTypeByJava(byte[].class));
 
         assertEquals(Types.TIMESTAMP, TypesMapping.getSqlTypeByJava(Calendar.class));
-        assertEquals(Types.TIMESTAMP, TypesMapping
-                .getSqlTypeByJava(GregorianCalendar.class));
+        assertEquals(
+                Types.TIMESTAMP,
+                TypesMapping.getSqlTypeByJava(GregorianCalendar.class));
         assertEquals(Types.BIGINT, TypesMapping.getSqlTypeByJava(BigInteger.class));
 
-        assertEquals(Types.VARBINARY, TypesMapping
-                .getSqlTypeByJava(MockSerializable.class));
+        assertEquals(
+                Types.VARBINARY,
+                TypesMapping.getSqlTypeByJava(MockSerializable.class));
         assertEquals(Types.VARCHAR, TypesMapping.getSqlTypeByJava(char[].class));
         assertEquals(Types.VARCHAR, TypesMapping.getSqlTypeByJava(Character[].class));
         assertEquals(Types.VARBINARY, TypesMapping.getSqlTypeByJava(Byte[].class));
@@ -62,19 +64,24 @@ public class TypesMappingTest extends Se
         // make sure we can handle arrays...
         assertEquals(Types.BINARY, TypesMapping.getSqlTypeByJava("byte[]"));
 
-        assertEquals(Types.TIMESTAMP, TypesMapping.getSqlTypeByJava(Calendar.class
-                .getName()));
-        assertEquals(Types.TIMESTAMP, TypesMapping
-                .getSqlTypeByJava(GregorianCalendar.class.getName()));
-        assertEquals(Types.BIGINT, TypesMapping.getSqlTypeByJava(BigInteger.class
-                .getName()));
-
-        assertEquals(Types.VARBINARY, TypesMapping
-                .getSqlTypeByJava(MockSerializable.class.getName()));
+        assertEquals(
+                Types.TIMESTAMP,
+                TypesMapping.getSqlTypeByJava(Calendar.class.getName()));
+        assertEquals(
+                Types.TIMESTAMP,
+                TypesMapping.getSqlTypeByJava(GregorianCalendar.class.getName()));
+        assertEquals(
+                Types.BIGINT,
+                TypesMapping.getSqlTypeByJava(BigInteger.class.getName()));
+
+        assertEquals(
+                Types.VARBINARY,
+                TypesMapping.getSqlTypeByJava(MockSerializable.class.getName()));
 
         assertEquals(Types.VARCHAR, TypesMapping.getSqlTypeByJava("char[]"));
-        assertEquals(Types.VARCHAR, TypesMapping
-                .getSqlTypeByJava("java.lang.Character[]"));
+        assertEquals(
+                Types.VARCHAR,
+                TypesMapping.getSqlTypeByJava("java.lang.Character[]"));
         assertEquals(Types.VARBINARY, TypesMapping.getSqlTypeByJava("java.lang.Byte[]"));
     }
 
@@ -83,26 +90,6 @@ public class TypesMappingTest extends Se
         assertEquals(Types.BIGINT, TypesMapping.getSqlTypeByJava(Long.TYPE));
     }
 
-    @Deprecated
-    public void testGetJavaBySqlType() {
-        assertEquals(TypesMapping.JAVA_INTEGER, TypesMapping.getJavaBySqlType(
-                Types.NUMERIC,
-                5,
-                0));
-        assertEquals(TypesMapping.JAVA_LONG, TypesMapping.getJavaBySqlType(
-                Types.NUMERIC,
-                15,
-                0));
-        assertEquals(TypesMapping.JAVA_BIGDECIMAL, TypesMapping.getJavaBySqlType(
-                Types.NUMERIC,
-                25,
-                0));
-        assertEquals(TypesMapping.JAVA_BIGDECIMAL, TypesMapping.getJavaBySqlType(
-                Types.NUMERIC,
-                25,
-                5));
-    }
-
     public void testTypeInfoCompleteness() throws Exception {
         // check counts
         // since more then 1 database type can map to a single JDBC type



Mime
View raw message