commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adri...@apache.org
Subject svn commit: r1042450 - in /commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert: AbstractConverter.java AbstractLocalizedConverter.java Converter.java Converters.java DateTimeConverters.java LocalizedConverter.java MiscConverters.java
Date Sun, 05 Dec 2010 21:16:53 GMT
Author: adrianc
Date: Sun Dec  5 21:16:51 2010
New Revision: 1042450

URL: http://svn.apache.org/viewvc?rev=1042450&view=rev
Log:
Removed an unused convert method from the Converter interface.

Modified:
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractConverter.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractLocalizedConverter.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converter.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converters.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/DateTimeConverters.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/LocalizedConverter.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/MiscConverters.java

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractConverter.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractConverter.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractConverter.java
Sun Dec  5 21:16:51 2010
@@ -35,10 +35,6 @@ public abstract class AbstractConverter<
         Converters.registerConverter(this);
     }
 
-    public T convert(Class<? extends T> targetClass, S obj) throws ConversionException
{
-        return convert(obj);
-    }
-
     public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
         return Util.instanceOf(sourceClass, this.getSourceClass()) && Util.instanceOf(targetClass,
this.getTargetClass());
     }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractLocalizedConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractLocalizedConverter.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractLocalizedConverter.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/AbstractLocalizedConverter.java
Sun Dec  5 21:16:51 2010
@@ -30,11 +30,7 @@ public abstract class AbstractLocalizedC
         super(sourceClass, targetClass);
     }
 
-    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone
timeZone) throws ConversionException {
-        return convert(obj, locale, timeZone);
-    }
-
-    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone
timeZone, String formatString) throws ConversionException {
-        return convert(obj, locale, timeZone, formatString);
+    public T convert(S obj, Locale locale, TimeZone timeZone) throws ConversionException
{
+        return convert(obj, locale, timeZone, null);
     }
 }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converter.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converter.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converter.java
Sun Dec  5 21:16:51 2010
@@ -45,15 +45,6 @@ public interface Converter<S, T> {
      */
     public T convert(S obj) throws ConversionException;
 
-    /** Converts <code>obj</code> to <code>T</code>.
-     *
-     * @param targetClass The <code>Class</code> to convert to
-     * @param obj The source <code>Object</code> to convert
-     * @return The converted <code>Object</code>
-     * @throws ConversionException
-     */
-    public T convert(Class<? extends T> targetClass, S obj) throws ConversionException;
-
     /** Returns the source <code>Class</code> for this converter.
      *
      * @return The source <code>Class</code> for this converter

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converters.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converters.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/Converters.java
Sun Dec  5 21:16:51 2010
@@ -229,11 +229,6 @@ OUTER:
             return (T) obj;
         }
 
-        @SuppressWarnings("unchecked")
-        public T convert(Class<? extends T> targetClass, S obj) throws ConversionException
{
-            return (T) obj;
-        }
-
         public Class<?> getSourceClass() {
             return sourceClass;
         }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/DateTimeConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/DateTimeConverters.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/DateTimeConverters.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/DateTimeConverters.java
Sun Dec  5 21:16:51 2010
@@ -132,7 +132,7 @@ public class DateTimeConverters implemen
     /**
      * An object that converts a <code>Calendar</code> to a <code>String</code>.
      */
-    public static class CalendarToString extends GenericLocalizedConverter<Calendar, String>
{
+    public static class CalendarToString extends AbstractLocalizedConverter<Calendar,
String> {
         public CalendarToString() {
             super(Calendar.class, String.class);
         }
@@ -187,7 +187,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>java.util.Date</code> to a
      * <code>String</code>.
      */
-    public static class DateToString extends GenericLocalizedConverter<Date, String>
{
+    public static class DateToString extends AbstractLocalizedConverter<Date, String>
{
         public DateToString() {
             super(Date.class, String.class);
         }
@@ -254,25 +254,10 @@ public class DateTimeConverters implemen
     }
 
     /**
-     * An abstract class that provides an implementation of the
-     * {@link org.apache.commons.convert.AbstractLocalizedConverter#convert(Object, Locale,
TimeZone)}
-     * method.
-     */
-    public static abstract class GenericLocalizedConverter<S, T> extends AbstractLocalizedConverter<S,
T> {
-        protected GenericLocalizedConverter(Class<S> sourceClass, Class<T> targetClass)
{
-            super(sourceClass, targetClass);
-        }
-
-        public T convert(S obj, Locale locale, TimeZone timeZone) throws ConversionException
{
-            return convert(obj, locale, timeZone, null);
-        }
-    }
-
-    /**
      * An object that converts a <code>Long</code> to a
      * <code>Calendar</code>.
      */
-    public static class LongToCalendar extends GenericLocalizedConverter<Long, Calendar>
{
+    public static class LongToCalendar extends AbstractLocalizedConverter<Long, Calendar>
{
         public LongToCalendar() {
             super(Long.class, Calendar.class);
         }
@@ -393,7 +378,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>java.sql.Date</code> to a
      * <code>String</code>.
      */
-    public static class SqlDateToString extends GenericLocalizedConverter<java.sql.Date,
String> {
+    public static class SqlDateToString extends AbstractLocalizedConverter<java.sql.Date,
String> {
         public SqlDateToString() {
             super(java.sql.Date.class, String.class);
         }
@@ -440,7 +425,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>java.sql.Time</code> to a
      * <code>String</code>.
      */
-    public static class SqlTimeToString extends GenericLocalizedConverter<java.sql.Time,
String> {
+    public static class SqlTimeToString extends AbstractLocalizedConverter<java.sql.Time,
String> {
         public SqlTimeToString() {
             super(java.sql.Time.class, String.class);
         }
@@ -465,7 +450,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>String</code> to a
      * <code>java.util.Calendar</code>.
      */
-    public static class StringToCalendar extends GenericLocalizedConverter<String, Calendar>
{
+    public static class StringToCalendar extends AbstractLocalizedConverter<String, Calendar>
{
         public StringToCalendar() {
             super(String.class, Calendar.class);
         }
@@ -509,7 +494,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>String</code> to a
      * <code>java.util.Date</code>.
      */
-    public static class StringToDate extends GenericLocalizedConverter<String, Date>
{
+    public static class StringToDate extends AbstractLocalizedConverter<String, Date>
{
         public StringToDate() {
             super(String.class, Date.class);
         }
@@ -547,7 +532,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>String</code> to a
      * <code>java.sql.Date</code>.
      */
-    public static class StringToSqlDate extends GenericLocalizedConverter<String, java.sql.Date>
{
+    public static class StringToSqlDate extends AbstractLocalizedConverter<String, java.sql.Date>
{
         public StringToSqlDate() {
             super(String.class, java.sql.Date.class);
         }
@@ -576,7 +561,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>String</code> to a
      * <code>java.sql.Time</code>.
      */
-    public static class StringToSqlTime extends GenericLocalizedConverter<String, java.sql.Time>
{
+    public static class StringToSqlTime extends AbstractLocalizedConverter<String, java.sql.Time>
{
         public StringToSqlTime() {
             super(String.class, java.sql.Time.class);
         }
@@ -605,7 +590,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>String</code> to a
      * <code>java.sql.Timestamp</code>.
      */
-    public static class StringToTimestamp extends GenericLocalizedConverter<String, java.sql.Timestamp>
{
+    public static class StringToTimestamp extends AbstractLocalizedConverter<String, java.sql.Timestamp>
{
         public StringToTimestamp() {
             super(String.class, java.sql.Timestamp.class);
         }
@@ -666,7 +651,7 @@ public class DateTimeConverters implemen
      * An object that converts a <code>java.sql.Timestamp</code> to a
      * <code>String</code>.
      */
-    public static class TimestampToString extends GenericLocalizedConverter<java.sql.Timestamp,
String> {
+    public static class TimestampToString extends AbstractLocalizedConverter<java.sql.Timestamp,
String> {
         public TimestampToString() {
             super(java.sql.Timestamp.class, String.class);
         }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/LocalizedConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/LocalizedConverter.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/LocalizedConverter.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/LocalizedConverter.java
Sun Dec  5 21:16:51 2010
@@ -38,17 +38,6 @@ public interface LocalizedConverter<S, T
 
     /** Converts <code>obj</code> to <code>T</code>.
      *
-     * @param targetClass The <code>Class</code> to convert to
-     * @param obj The source <code>Object</code> to convert
-     * @param locale The locale used for conversion - must not be <code>null</code>
-     * @param timeZone The time zone used for conversion - must not be <code>null</code>
-     * @return The converted <code>Object</code>
-     * @throws ConversionException
-     */
-    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone
timeZone) throws ConversionException;
-
-    /** Converts <code>obj</code> to <code>T</code>.
-     *
      * @param obj The source <code>Object</code> to convert
      * @param locale The locale used for conversion - must not be <code>null</code>
      * @param timeZone The time zone used for conversion - must not be <code>null</code>
@@ -57,16 +46,4 @@ public interface LocalizedConverter<S, T
      * @throws ConversionException
      */
     public T convert(S obj, Locale locale, TimeZone timeZone, String formatString) throws
ConversionException;
-
-    /** Converts <code>obj</code> to <code>T</code>.
-     *
-     * @param targetClass The <code>Class</code> to convert to
-     * @param obj The source <code>Object</code> to convert
-     * @param locale The locale used for conversion - must not be <code>null</code>
-     * @param timeZone The time zone used for conversion - must not be <code>null</code>
-     * @param formatString Optional formatting string
-     * @return The converted <code>Object</code>
-     * @throws ConversionException
-     */
-    public T convert(Class<? extends T> targetClass, S obj, Locale locale, TimeZone
timeZone, String formatString) throws ConversionException;
 }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/MiscConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/MiscConverters.java?rev=1042450&r1=1042449&r2=1042450&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/MiscConverters.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/MiscConverters.java
Sun Dec  5 21:16:51 2010
@@ -184,10 +184,6 @@ public class MiscConverters implements C
             return Enum.class.isAssignableFrom(sourceClass) && String.class.isAssignableFrom(targetClass);
         }
 
-        public String convert(Class<? extends String> targetClass, Enum<?> obj)
throws ConversionException {
-            return convert(obj);
-        }
-
         public String convert(Enum<?> obj) throws ConversionException {
             return obj.toString();
         }
@@ -258,10 +254,6 @@ public class MiscConverters implements C
             return String.class.isAssignableFrom(sourceClass) && Enum.class.isAssignableFrom(targetClass);
         }
 
-        public E convert(Class<? extends E> targetClass, String obj) throws ConversionException
{
-            return Enum.valueOf(Util.<Class<E>>cast(targetClass), obj);
-        }
-
         public E convert(String obj) throws ConversionException {
             throw new UnsupportedOperationException();
         }



Mime
View raw message