commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adri...@apache.org
Subject svn commit: r1039522 - /commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/
Date Fri, 26 Nov 2010 19:25:21 GMT
Author: adrianc
Date: Fri Nov 26 19:25:20 2010
New Revision: 1039522

URL: http://svn.apache.org/viewvc?rev=1039522&view=rev
Log:
Initial pass at building out JavaDocs.

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/BooleanConverters.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/CollectionConverters.java
    commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/ConverterCreator.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/GenericToStringConverter.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=1039522&r1=1039521&r2=1039522&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
Fri Nov 26 19:25:20 2010
@@ -18,9 +18,9 @@
  *******************************************************************************/
 package org.apache.commons.convert;
 
-/** Abstract Converter class. This class handles converter registration
- * and it implements the <code>canConvert</code>, <code>getSourceClass</code>,
- * and <code>getTargetClass</code> methods.
+/**
+ * Abstract converter class. This class handles converter registration
+ * and it implements some of the <code>Converter</code> methods.
  */
 public abstract class AbstractConverter<S, T> implements Converter<S, T>, ConverterLoader
{
     private final Class<? super S> sourceClass;

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=1039522&r1=1039521&r2=1039522&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
Fri Nov 26 19:25:20 2010
@@ -21,9 +21,9 @@ package org.apache.commons.convert;
 import java.util.Locale;
 import java.util.TimeZone;
 
-/** Abstract LocalizedConverter class. This class handles converter registration
- * and it implements the <code>canConvert</code>, <code>getSourceClass</code>,
- * and <code>getTargetClass</code> methods.
+/**
+ * Abstract localized converter class. This class handles converter registration
+ * and it implements some of the <code>Converter</code> methods.
  */
 public abstract class AbstractLocalizedConverter<S, T> extends AbstractConverter<S,
T> implements LocalizedConverter<S, T> {
     protected AbstractLocalizedConverter(Class<? super S> sourceClass, Class<? super
T> targetClass) {

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/BooleanConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/BooleanConverters.java?rev=1039522&r1=1039521&r2=1039522&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/BooleanConverters.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/BooleanConverters.java
Fri Nov 26 19:25:20 2010
@@ -18,33 +18,55 @@
  *******************************************************************************/
 package org.apache.commons.convert;
 
-/** Boolean Converter classes. */
+/** Boolean <code>Converter</code> classes. */
 public class BooleanConverters implements ConverterLoader {
+    /**
+     * An object that converts a <code>Boolean</code> to an <code>Integer</code>.
+     */
     public static class BooleanToInteger extends AbstractConverter<Boolean, Integer>
{
         public BooleanToInteger() {
             super(Boolean.class, Integer.class);
         }
 
+        /**
+         * Returns 1 if <code>obj</code> is true, or zero if 
+         * <code>obj</code> is false.
+         */
         public Integer convert(Boolean obj) throws ConversionException {
              return obj.booleanValue() ? 1 : 0;
         }
     }
 
+    /**
+     * An object that converts an <code>Integer</code> to a <code>Boolean</code>.
+     */
     public static class IntegerToBoolean extends AbstractConverter<Integer, Boolean>
{
         public IntegerToBoolean() {
             super(Integer.class, Boolean.class);
         }
 
+        /**
+         * Returns <code>true</code> if <code>obj</code> is non-zero,
or
+         * <code>false</code> if <code>obj</code> is zero.
+         */
         public Boolean convert(Integer obj) throws ConversionException {
              return obj.intValue() == 0 ? false : true;
         }
     }
 
+    /**
+     * An object that converts a <code>String</code> to a <code>Boolean</code>.
+     */
     public static class StringToBoolean extends AbstractConverter<String, Boolean>
{
         public StringToBoolean() {
             super(String.class, Boolean.class);
         }
 
+        /**
+         * Returns <code>true</code> if <code>obj</code> equals "true",
or
+         * <code>false</code> if <code>obj</code> is any other value.
The
+         * test for "true" is case-insensitive.
+         */
         public Boolean convert(String obj) throws ConversionException {
             return "TRUE".equals(obj.trim().toUpperCase());
         }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/CollectionConverters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/CollectionConverters.java?rev=1039522&r1=1039521&r2=1039522&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/CollectionConverters.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/CollectionConverters.java
Fri Nov 26 19:25:20 2010
@@ -29,7 +29,7 @@ import java.util.Map;
 import java.util.HashSet;
 import java.util.Set;
 
-/** Collection Converter classes. */
+/** Collection <code>Converter</code> classes. */
 public class CollectionConverters implements ConverterLoader {
 
     @SuppressWarnings("unchecked")
@@ -169,6 +169,9 @@ public class CollectionConverters implem
         }
     }
 
+    /**
+     * An object that converts an array to a <code>List</code>.
+     */
     public static class ArrayToList<T> extends AbstractConverter<T[], List<T>>
{
         public ArrayToList() {
             super(Object[].class, List.class);
@@ -188,6 +191,10 @@ public class CollectionConverters implem
             return false;
         }
 
+        /**
+         * Returns a <code>List</code> that contains the elements in
+         * <code>obj</code>.
+         */
         public List<T> convert(T[] obj) throws ConversionException {
             return Arrays.asList(obj);
         }

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/ConverterCreator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/ConverterCreator.java?rev=1039522&r1=1039521&r2=1039522&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/ConverterCreator.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/ConverterCreator.java
Fri Nov 26 19:25:20 2010
@@ -18,17 +18,24 @@
  *******************************************************************************/
 package org.apache.commons.convert;
 
-/** ConverterCreator interface. Classes implement this interface to create a
- * converter that can convert one Java object type to another.
+/**
+ * ConverterCreator interface. Classes implement this interface to create
+ * a converter that can convert one Java object type to another.
+ * 
+ * <p>
+ * <code>ConverterCreator</code> is used to dynamically create converters
+ * for target classes that implement an interface.
+ * </p>
  */
 public interface ConverterCreator {
     /** Creates a Converter that can convert the <code>sourceClass</code> to
      * the <code>targetClass</code>. Returns <code>null</code> if
this creator
      * doesn't support the class pair.
      *
-     * @param sourceClass The source <code>Class</code> to convert
+     * @param sourceClass The source <code>Class</code> to convert from
      * @param targetClass The target <code>Class</code> to convert to
-     * @return a converter that can convert <code>Object</code>s
+     * @return A <code>Converter</code> that can convert <code>sourceClass</code>
+     * to <code>targetClass</code>
      */
     public <S, T> Converter<S, T> createConverter(Class<S> sourceClass,
Class<T> targetClass);
 }

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=1039522&r1=1039521&r2=1039522&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
Fri Nov 26 19:25:20 2010
@@ -29,8 +29,8 @@ import javax.imageio.spi.ServiceRegistry
 
 /** A <code>Converter</code> factory and utility class.
  * <p>The factory loads {@link org.apache.commons.convert.Converter} instances
- * via the Java service provider registry. Applications that need to extend the
- * converter framework can do so by:<br />
+ * via the Java service provider registry. Applications can extend the
+ * converter framework by:<br />
  * <ul>
  * <li>Creating classes the implement the
  * {@link org.apache.commons.convert.Converter} class</li>
@@ -118,7 +118,7 @@ OUTER:
      * implementations
      */
     public static void loadContainedConverters(Class<?> containerClass) {
-        // This only returns -public- classes and interfaces
+        // This only returns public classes and interfaces
         for (Class<?> clz: containerClass.getClasses()) {
             try {
                 // non-abstract, which means no interfaces or abstract classes

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=1039522&r1=1039521&r2=1039522&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
Fri Nov 26 19:25:20 2010
@@ -28,12 +28,24 @@ import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
-/** Date/time Converter classes. */
+/** Date/time <code>Converter</code> classes. */
 public class DateTimeConverters implements ConverterLoader {
 
+    /**
+     * Calendar format string: <code>EEE MMM dd HH:mm:ss.SSS z yyyy</code>. 
+     */
     public static final String CALENDAR_FORMAT = "EEE MMM dd HH:mm:ss.SSS z yyyy";
+    /**
+     * JDBC DATE format string: <code>yyyy-MM-dd</code>. 
+     */
     public static final String JDBC_DATE_FORMAT = "yyyy-MM-dd";
+    /**
+     * JDBC TIME format string: <code>HH:mm:ss</code>. 
+     */
     public static final String JDBC_TIME_FORMAT = "HH:mm:ss";
+    /**
+     * JDBC TIMESTAMP format string: <code>yyyy-MM-dd HH:mm:ss.SSS</code>. 
+     */
     public static final String JDBC_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
 
     /**
@@ -101,28 +113,47 @@ public class DateTimeConverters implemen
         Converters.registerConverter(new GenericSingletonToSet<java.sql.Timestamp>(java.sql.Timestamp.class));
     }
 
+    /**
+     * An object that converts a <code>Calendar</code> to a <code>Long</code>.
+     */
     public static class CalendarToLong extends AbstractConverter<Calendar, Long> {
         public CalendarToLong() {
             super(Calendar.class, Long.class);
         }
 
+        /**
+         * Returns the millisecond value of <code>obj</code>.
+         */
         public Long convert(Calendar obj) throws ConversionException {
             return obj.getTimeInMillis();
         }
     }
 
+    /**
+     * An object that converts a <code>Calendar</code> to a <code>String</code>.
+     */
     public static class CalendarToString extends GenericLocalizedConverter<Calendar, String>
{
         public CalendarToString() {
             super(Calendar.class, String.class);
         }
 
-        @Override
+        /**
+         * Converts <code>obj</code> to a <code>String</code> formatted
as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}. The returned string is
+         * referenced to the default time zone.
+         */
         public String convert(Calendar obj) throws ConversionException {
             DateFormat df = new SimpleDateFormat(CALENDAR_FORMAT);
             df.setCalendar(obj);
             return df.format(obj.getTime());
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>String</code> using
the supplied
+         * locale, time zone, and format string. If <code>formatString</code>
is
+         * <code>null</code>, the string is formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public String convert(Calendar obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? CALENDAR_FORMAT : formatString,
timeZone, locale);
             df.setCalendar(obj);
@@ -130,6 +161,10 @@ public class DateTimeConverters implemen
         }
     }
 
+    /**
+     * An object that converts a <code>java.util.Date</code> to a
+     * <code>java.sql.Date</code>.
+     */
     public static class DateToSqlDate extends AbstractConverter<Date, java.sql.Date>
{
         public DateToSqlDate() {
             super(Date.class, java.sql.Date.class);
@@ -140,28 +175,49 @@ public class DateTimeConverters implemen
             return (java.util.Date.class.equals(sourceClass) || java.sql.Timestamp.class.equals(sourceClass))
&& java.sql.Date.class.equals(targetClass);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Date</code>.
+         */
         public java.sql.Date convert(Date obj) throws ConversionException {
             return new java.sql.Date(obj.getTime());
         }
     }
 
+    /**
+     * An object that converts a <code>java.util.Date</code> to a
+     * <code>String</code>.
+     */
     public static class DateToString extends GenericLocalizedConverter<Date, String>
{
         public DateToString() {
             super(Date.class, String.class);
         }
 
-        @Override
+        /**
+         * Converts <code>obj</code> to a <code>String</code> formatted
as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}. The returned string is
+         * referenced to the default time zone.
+         */
         public String convert(Date obj) throws ConversionException {
             DateFormat df = new SimpleDateFormat(CALENDAR_FORMAT);
             return df.format(obj);
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>String</code> using
the supplied
+         * locale, time zone, and format string. If <code>formatString</code>
is
+         * <code>null</code>, the string is formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public String convert(Date obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? CALENDAR_FORMAT : formatString,
timeZone, locale);
             return df.format(obj);
         }
     }
 
+    /**
+     * An object that converts a <code>java.util.Date</code> to a
+     * <code>java.sql.Timestamp</code>.
+     */
     public static class DateToTimestamp extends AbstractConverter<Date, java.sql.Timestamp>
{
         public DateToTimestamp() {
             super(Date.class, java.sql.Timestamp.class);
@@ -172,21 +228,36 @@ public class DateTimeConverters implemen
             return (java.util.Date.class.equals(sourceClass) || java.sql.Timestamp.class.equals(sourceClass))
&& java.sql.Timestamp.class.equals(targetClass);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Timestamp</code>.
+         */
         public java.sql.Timestamp convert(Date obj) throws ConversionException {
             return new java.sql.Timestamp(obj.getTime());
         }
     }
 
+    /**
+     * An object that converts a <code>java.util.Date</code> (and its subclasses)
to a
+     * <code>Long</code>.
+     */
     public static class GenericDateToLong<S extends Date> extends AbstractConverter<S,
Long> {
         public GenericDateToLong(Class<S> source) {
             super(source, Long.class);
         }
 
+        /**
+         * Returns the millisecond value of <code>obj</code>.
+         */
         public Long convert(S obj) throws ConversionException {
             return obj.getTime();
         }
     }
 
+    /**
+     * 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);
@@ -197,17 +268,30 @@ public class DateTimeConverters implemen
         }
     }
 
+    /**
+     * An object that converts a <code>Long</code> to a
+     * <code>Calendar</code>.
+     */
     public static class LongToCalendar extends GenericLocalizedConverter<Long, Calendar>
{
         public LongToCalendar() {
             super(Long.class, Calendar.class);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>Calendar</code>,
+         * initialized with the default locale and time zone.
+         */
         public Calendar convert(Long obj) throws ConversionException {
             Calendar cal = Calendar.getInstance();
             cal.setTimeInMillis(obj);
             return cal;
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>Calendar</code>,
+         * initialized with the specified locale and time zone. The
+         * <code>formatString</code> parameter is ignored.
+         */
         public Calendar convert(Long obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             Calendar cal = Calendar.getInstance(timeZone, locale);
             cal.setTimeInMillis(obj);
@@ -215,46 +299,78 @@ public class DateTimeConverters implemen
         }
     }
 
+    /**
+     * An object that converts a <code>Long</code> to a
+     * <code>java.util.Date</code>.
+     */
     public static class LongToDate extends AbstractConverter<Long, Date> {
         public LongToDate() {
             super(Long.class, Date.class);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.util.Date</code>.
+         */
         public Date convert(Long obj) throws ConversionException {
             return new Date(obj.longValue());
         }
     }
 
+    /**
+     * An object that converts a <code>Long</code> to a
+     * <code>java.sql.Date</code>.
+     */
     public static class LongToSqlDate extends AbstractConverter<Long, java.sql.Date>
{
         public LongToSqlDate() {
             super(Long.class, java.sql.Date.class);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Date</code>.
+         */
         public java.sql.Date convert(Long obj) throws ConversionException {
             return new java.sql.Date(obj.longValue());
         }
     }
 
+    /**
+     * An object that converts a <code>Long</code> to a
+     * <code>java.sql.Time</code>.
+     */
     public static class LongToSqlTime extends AbstractConverter<Long, java.sql.Time>
{
         public LongToSqlTime() {
             super(Long.class, java.sql.Time.class);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Time</code>.
+         */
         public java.sql.Time convert(Long obj) throws ConversionException {
             return new java.sql.Time(obj.longValue());
         }
     }
 
+    /**
+     * An object that converts a <code>Long</code> to a
+     * <code>java.sql.Timestamp</code>.
+     */
     public static class LongToTimestamp extends AbstractConverter<Long, java.sql.Timestamp>
{
         public LongToTimestamp() {
             super(Long.class, java.sql.Timestamp.class);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Timestamp</code>.
+         */
         public java.sql.Timestamp convert(Long obj) throws ConversionException {
             return new java.sql.Timestamp(obj.longValue());
         }
     }
 
+    /**
+     * An object that converts a <code>java.sql.Date</code> to a
+     * <code>java.util.Date</code>.
+     */
     public static class SqlDateToDate extends AbstractConverter<java.sql.Date, Date>
{
         public SqlDateToDate() {
             super(java.sql.Date.class, Date.class);
@@ -265,27 +381,43 @@ public class DateTimeConverters implemen
             return java.sql.Date.class.equals(sourceClass) && java.util.Date.class.equals(targetClass);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.util.Date</code>.
+         */
         public Date convert(java.sql.Date obj) throws ConversionException {
             return new Date(obj.getTime());
         }
     }
 
+    /**
+     * 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 SqlDateToString() {
             super(java.sql.Date.class, String.class);
         }
 
-        @Override
         public String convert(java.sql.Date obj) throws ConversionException {
             return obj.toString();
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>String</code> using
the supplied
+         * time zone. The <code>formatString</code> parameter is
+         * ignored. The returned string is formatted as
+         * {@link DateTimeConverters#JDBC_DATE_FORMAT}.
+         */
         public String convert(java.sql.Date obj, Locale locale, TimeZone timeZone, String
formatString) throws ConversionException {
             DateFormat df = toDateFormat(timeZone);
             return df.format(obj);
         }
     }
 
+    /**
+     * An object that converts a <code>java.sql.Date</code> to a
+     * <code>java.sql.Timestamp</code>.
+     */
     public static class SqlDateToTimestamp extends AbstractConverter<java.sql.Date, java.sql.Timestamp>
{
         public SqlDateToTimestamp() {
             super(java.sql.Date.class, java.sql.Timestamp.class);
@@ -296,32 +428,53 @@ public class DateTimeConverters implemen
             return java.sql.Date.class.equals(sourceClass) && java.sql.Timestamp.class.equals(targetClass);
         }
 
+        /**
+         * Returns <code>obj</code> converted to a <code>java.sql.Timestamp</code>.
+         */
         public java.sql.Timestamp convert(java.sql.Date obj) throws ConversionException {
             return new java.sql.Timestamp(obj.getTime());
         }
     }
 
+    /**
+     * 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 SqlTimeToString() {
             super(java.sql.Time.class, String.class);
         }
 
-        @Override
         public String convert(java.sql.Time obj) throws ConversionException {
             return obj.toString();
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>String</code> using
the supplied
+         * time zone. The <code>formatString</code> parameter is
+         * ignored. The returned string is formatted as
+         * {@link DateTimeConverters#JDBC_TIME_FORMAT}.
+         */
         public String convert(java.sql.Time obj, Locale locale, TimeZone timeZone, String
formatString) throws ConversionException {
             DateFormat df = toTimeFormat(timeZone);
             return df.format(obj);
         }
     }
 
+    /**
+     * An object that converts a <code>String</code> to a
+     * <code>java.util.Calendar</code>.
+     */
     public static class StringToCalendar extends GenericLocalizedConverter<String, Calendar>
{
         public StringToCalendar() {
             super(String.class, Calendar.class);
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>java.util.Calendar</code>
initialized to
+         * the default locale and time zone. The string must be formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public Calendar convert(String obj) throws ConversionException {
             try {
                 DateFormat df = new SimpleDateFormat(CALENDAR_FORMAT);
@@ -333,6 +486,12 @@ public class DateTimeConverters implemen
             }
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>java.util.Calendar</code>
initialized to
+         * the supplied locale and time zone. If <code>formatString</code> is
+         * <code>null</code>, the string is formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public Calendar convert(String obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? CALENDAR_FORMAT : formatString,
timeZone, locale);
             try {
@@ -346,12 +505,20 @@ 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 StringToDate() {
             super(String.class, Date.class);
         }
 
-        @Override
+        /**
+         * Converts <code>obj</code> to a <code>java.util.Date</code>.
+         * The string must be formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public Date convert(String obj) throws ConversionException {
             try {
                 DateFormat df = new SimpleDateFormat(CALENDAR_FORMAT);
@@ -361,6 +528,11 @@ public class DateTimeConverters implemen
             }
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>java.util.Date</code>.
If
+         * <code>formatString</code> is <code>null</code>, the string
is formatted as
+         * {@link DateTimeConverters#CALENDAR_FORMAT}.
+         */
         public Date convert(String obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? CALENDAR_FORMAT : formatString,
timeZone, locale);
             try {
@@ -371,17 +543,25 @@ 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 StringToSqlDate() {
             super(String.class, java.sql.Date.class);
         }
 
-        @Override
         public java.sql.Date convert(String obj) throws ConversionException {
             return java.sql.Date.valueOf(obj);
         }
 
-        @Override
+        /**
+         * Converts <code>obj</code> to a <code>java.sql.Date</code>
using the supplied
+         * time zone. The <code>locale</code> and <code>formatString</code>
parameters are
+         * ignored. The string must be formatted as
+         * {@link DateTimeConverters#JDBC_DATE_FORMAT}.
+         */
         public java.sql.Date convert(String obj, Locale locale, TimeZone timeZone, String
formatString) throws ConversionException {
             DateFormat df = toDateFormat(timeZone);
             try {
@@ -392,17 +572,25 @@ 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 StringToSqlTime() {
             super(String.class, java.sql.Time.class);
         }
 
-        @Override
         public java.sql.Time convert(String obj) throws ConversionException {
             return java.sql.Time.valueOf(obj);
         }
 
-        @Override
+        /**
+         * Converts <code>obj</code> to a <code>java.sql.Time</code>
using the supplied
+         * time zone. The <code>locale</code> and <code>formatString</code>
parameters are
+         * ignored. The string must be formatted as
+         * {@link DateTimeConverters#JDBC_TIME_FORMAT}.
+         */
         public Time convert(String obj, Locale locale, TimeZone timeZone, String formatString)
throws ConversionException {
             DateFormat df = toTimeFormat(timeZone);
             try {
@@ -413,16 +601,24 @@ 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 StringToTimestamp() {
             super(String.class, java.sql.Timestamp.class);
         }
 
-        @Override
         public Timestamp convert(String obj) throws ConversionException {
             return java.sql.Timestamp.valueOf(obj);
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>java.sql.Timestamp</code>.
If
+         * <code>formatString</code> is <code>null</code>, the string
must be
+         * formatted as {@link DateTimeConverters#JDBC_TIMESTAMP_FORMAT}.
+         */
         public java.sql.Timestamp convert(String obj, Locale locale, TimeZone timeZone, String
formatString) throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? JDBC_TIMESTAMP_FORMAT
: formatString, timeZone, locale);
             try {
@@ -433,6 +629,10 @@ public class DateTimeConverters implemen
         }
     }
 
+    /**
+     * An object that converts a <code>String</code> ID to a
+     * <code>java.util.TimeZone</code>.
+     */
     public static class StringToTimeZone extends AbstractConverter<String, TimeZone>
{
         public StringToTimeZone() {
             super(String.class, TimeZone.class);
@@ -443,6 +643,10 @@ public class DateTimeConverters implemen
         }
     }
 
+    /**
+     * An object that converts a <code>java.sql.Timestamp</code> to a
+     * <code>java.util.Date</code>.
+     */
     public static class TimestampToDate extends AbstractConverter<java.sql.Timestamp,
Date> {
         public TimestampToDate() {
             super(java.sql.Timestamp.class, Date.class);
@@ -458,22 +662,35 @@ 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 TimestampToString() {
             super(java.sql.Timestamp.class, String.class);
         }
 
-        @Override
         public String convert(java.sql.Timestamp obj) throws ConversionException {
             return obj.toString();
         }
 
+        /**
+         * Converts <code>obj</code> to a <code>String</code> using
the supplied
+         * locale, time zone, and format string. If <code>formatString</code>
is
+         * <code>null</code>, the string is formatted as
+         * {@link DateTimeConverters#JDBC_TIMESTAMP_FORMAT}.
+         */
         public String convert(java.sql.Timestamp obj, Locale locale, TimeZone timeZone, String
formatString) throws ConversionException {
             DateFormat df = toDateTimeFormat(formatString == null ? JDBC_TIMESTAMP_FORMAT
: formatString, timeZone, locale);
             return df.format(obj);
         }
     }
 
+    /**
+     * An object that converts a <code>java.util.TimeZone</code> to a
+     * <code>String</code> ID.
+     */
     public static class TimeZoneToString extends AbstractConverter<TimeZone, String>
{
         public TimeZoneToString() {
             super(TimeZone.class, String.class);

Modified: commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/GenericToStringConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/GenericToStringConverter.java?rev=1039522&r1=1039521&r2=1039522&view=diff
==============================================================================
--- commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/GenericToStringConverter.java
(original)
+++ commons/sandbox/convert/trunk/src/main/java/org/apache/commons/convert/GenericToStringConverter.java
Fri Nov 26 19:25:20 2010
@@ -25,7 +25,6 @@ public class GenericToStringConverter<S>
         super(sourceClass, String.class);
     }
 
-    @Override
     public String convert(S obj) throws ConversionException {
         return obj.toString();
     }



Mime
View raw message