commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy DefaultObjectStringConverter.java
Date Thu, 21 Aug 2003 17:07:18 GMT
rdonkin     2003/08/21 10:07:18

  Modified:    betwixt/src/java/org/apache/commons/betwixt/strategy
                        DefaultObjectStringConverter.java
  Log:
  Corrected java docs
  
  Revision  Changes    Path
  1.2       +25 -16    jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/DefaultObjectStringConverter.java
  
  Index: DefaultObjectStringConverter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/strategy/DefaultObjectStringConverter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultObjectStringConverter.java	31 Jul 2003 21:38:31 -0000	1.1
  +++ DefaultObjectStringConverter.java	21 Aug 2003 17:07:18 -0000	1.2
  @@ -71,31 +71,39 @@
   /** 
    * <p>Default string &lt;-&gt; object conversion strategy.</p>
    * <p>
  - * This delegates to ConvertUtils except when the type is assignable from <code>java.util.Date</code>
  + * This delegates to ConvertUtils except when the type 
  + * is assignable from <code>java.util.Date</code>
    * but not from <code>java.sql.Date</code>.
  - * In this case, the format used is (in SimpleDateFormat terms) <code>EEE MMM dd
HH:mm:ss zzz yyyy</code>.
  + * In this case, the format used is (in SimpleDateFormat terms) 
  + * <code>EEE MMM dd HH:mm:ss zzz yyyy</code>.
    * This is the same as the output of the toString method on java.util.Date.
    * </p>
    * <p>
    * This should preserve the existing symantic behaviour whilst allowing round tripping
of dates
    * (given the default settings).
    * </p>
  + * @author Robert Burrell Donkin
    */
   public class DefaultObjectStringConverter extends ConvertUtilsObjectStringConverter {
       
       /** Formats Dates to Strings and Strings to Dates */
  -    private final static SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd
HH:mm:ss zzz yyyy");
  +    private static final SimpleDateFormat formatter 
  +        = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy");
       
       /**
         * Converts an object to a string representation using ConvertUtils.
  -      * If the object is a java.util.Date and the type is java.util.Date but not java.sql.Date
  -      * then SimpleDateFormat formatting to <code>EEE MMM dd HH:mm:ss zzz yyyy</code>
  +      * If the object is a java.util.Date and the type is java.util.Date 
  +      * but not java.sql.Date
  +      * then SimpleDateFormat formatting to 
  +      * <code>EEE MMM dd HH:mm:ss zzz yyyy</code>
         * will be used. 
         * (This is the same as java.util.Date toString would return.)
         *
         * @param object the object to be converted, possibly null
         * @param type the property class of the object, not null
  -      * @param flavour a string allow symantic differences in formatting to be communicated
(ignored)
  +      * @param flavour a string allow symantic differences in formatting 
  +      * to be communicated (ignored)
  +      * @param context convert against this context not null
         * @return a String representation, not null
         */
       public String objectToString(Object object, Class type, String flavour, Context context)
{
  @@ -122,12 +130,11 @@
         */
       public Object stringToObject(String value, Class type, String flavour, Context context)
{
               if ( isUtilDate( type ) ) {
  -                try
  -                {
  +                try {
  +                    
                       return formatter.parse( value );
  -                }
  -                catch ( ParseException ex )
  -                { 
  +                    
  +                } catch ( ParseException ex ) { 
                       handleException( ex );
                       // this supports any subclasses that do not which to throw exceptions
                       // probably will result in a problem when the method will be invoked
  @@ -152,7 +159,9 @@
       }
       
       /**
  -      * Is the given type a java.util.Date but not a java.sql.Date.
  +      * Is the given type a java.util.Date but not a java.sql.Date?
  +      * @param type test this class type
  +      * @return true is this is a until date but not a sql one
         */
       private boolean isUtilDate(Class type) {
           return ( java.util.Date.class.isAssignableFrom(type) 
  
  
  

Mime
View raw message