commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/time FastDateFormat.java
Date Sat, 29 Nov 2003 13:52:34 GMT
scolebourne    2003/11/29 05:52:34

  Modified:    lang/src/java/org/apache/commons/lang/time
                        FastDateFormat.java
  Log:
  Add extra factory methods for convenience
  bug 23590, from Nikolay Metchev
  
  Revision  Changes    Path
  1.17      +135 -1    jakarta-commons/lang/src/java/org/apache/commons/lang/time/FastDateFormat.java
  
  Index: FastDateFormat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/time/FastDateFormat.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FastDateFormat.java	7 Sep 2003 14:32:35 -0000	1.16
  +++ FastDateFormat.java	29 Nov 2003 13:52:34 -0000	1.17
  @@ -97,6 +97,7 @@
    * @author Sean Schofield
    * @author Gary Gregory
    * @author Stephen Colebourne
  + * @author Nikolay Metchev
    * @since 2.0
    * @version $Id$
    */
  @@ -247,6 +248,48 @@
           return format;
       }
   
  +    //-----------------------------------------------------------------------
  +    /**
  +     * <p>Gets a date formatter instance using the specified style in the
  +     * default time zone and locale.</p>
  +     * 
  +     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @return a localized standard date formatter
  +     * @throws IllegalArgumentException if the Locale has no date
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateInstance(int style) {
  +        return getDateInstance(style, null, null);
  +    }
  +
  +    /**
  +     * <p>Gets a date formatter instance using the specified style and
  +     * locale in the default time zone.</p>
  +     * 
  +     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @param locale  optional locale, overrides system locale
  +     * @return a localized standard date formatter
  +     * @throws IllegalArgumentException if the Locale has no date
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateInstance(int style, Locale locale) {
  +        return getDateInstance(style, null, locale);
  +    }
  +
  +    /**
  +     * <p>Gets a date formatter instance using the specified style and
  +     * time zone in the default locale.</p>
  +     * 
  +     * @param style  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeZone  optional time zone, overrides time zone of
  +     *  formatted date
  +     * @return a localized standard date formatter
  +     * @throws IllegalArgumentException if the Locale has no date
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateInstance(int style, TimeZone timeZone) {
  +        return getDateInstance(style, timeZone, null);
  +    }
       /**
        * <p>Gets a date formatter instance using the specified style, time
        * zone and locale.</p>
  @@ -287,6 +330,49 @@
           return format;
       }
   
  +    //-----------------------------------------------------------------------
  +    /**
  +     * <p>Gets a time formatter instance using the specified style in the
  +     * default time zone and locale.</p>
  +     * 
  +     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @return a localized standard time formatter
  +     * @throws IllegalArgumentException if the Locale has no time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getTimeInstance(int style) {
  +        return getTimeInstance(style, null, null);
  +    }
  +
  +    /**
  +     * <p>Gets a time formatter instance using the specified style and
  +     * locale in the default time zone.</p>
  +     * 
  +     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @param locale  optional locale, overrides system locale
  +     * @return a localized standard time formatter
  +     * @throws IllegalArgumentException if the Locale has no time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getTimeInstance(int style, Locale locale) {
  +        return getTimeInstance(style, null, locale);
  +    }
  +    
  +    /**
  +     * <p>Gets a time formatter instance using the specified style and
  +     * time zone in the default locale.</p>
  +     * 
  +     * @param style  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeZone  optional time zone, overrides time zone of
  +     *  formatted time
  +     * @return a localized standard time formatter
  +     * @throws IllegalArgumentException if the Locale has no time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getTimeInstance(int style, TimeZone timeZone) {
  +        return getTimeInstance(style, timeZone, null);
  +    }
  +    
       /**
        * <p>Gets a time formatter instance using the specified style, time
        * zone and locale.</p>
  @@ -327,6 +413,54 @@
           return format;
       }
   
  +    //-----------------------------------------------------------------------
  +    /**
  +     * <p>Gets a date/time formatter instance using the specified style
  +     * in the default time zone and locale.</p>
  +     * 
  +     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @return a localized standard date/time formatter
  +     * @throws IllegalArgumentException if the Locale has no date/time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateTimeInstance(
  +            int dateStyle, int timeStyle) {
  +        return getDateTimeInstance(dateStyle, timeStyle, null, null);
  +    }
  +    
  +    /**
  +     * <p>Gets a date/time formatter instance using the specified style and
  +     * locale in the default time zone.</p>
  +     * 
  +     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @param locale  optional locale, overrides system locale
  +     * @return a localized standard date/time formatter
  +     * @throws IllegalArgumentException if the Locale has no date/time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateTimeInstance(
  +            int dateStyle, int timeStyle, Locale locale) {
  +        return getDateTimeInstance(dateStyle, timeStyle, null, locale);
  +    }
  +    
  +    /**
  +     * <p>Gets a date/time formatter instance using the specified style and
  +     * time zone in the default locale.</p>
  +     * 
  +     * @param dateStyle  date style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeStyle  time style: FULL, LONG, MEDIUM, or SHORT
  +     * @param timeZone  optional time zone, overrides time zone of
  +     *  formatted date
  +     * @return a localized standard date/time formatter
  +     * @throws IllegalArgumentException if the Locale has no date/time
  +     *  pattern defined
  +     */
  +    public static FastDateFormat getDateTimeInstance(
  +            int dateStyle, int timeStyle, TimeZone timeZone) {
  +        return getDateTimeInstance(dateStyle, timeStyle, timeZone, null);
  +    }    
       /**
        * <p>Gets a date/time formatter instance using the specified style,
        * time zone and locale.</p>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message