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/beanutils/src/java/org/apache/commons/beanutils/locale/converters BigDecimalLocaleConverter.java BigIntegerLocaleConverter.java ByteLocaleConverter.java DateLocaleConverter.java DecimalLocaleConverter.java DoubleLocaleConverter.java FloatLocaleConverter.java IntegerLocaleConverter.java LongLocaleConverter.java ShortLocaleConverter.java SqlDateLocaleConverter.java SqlTimeLocaleConverter.java SqlTimestampLocaleConverter.java StringLocaleConverter.java package.html
Date Tue, 03 Sep 2002 21:34:21 GMT
rdonkin     2002/09/03 14:34:21

  Modified:    beanutils/src/java/org/apache/commons/beanutils package.html
  Added:       beanutils/src/java/org/apache/commons/beanutils/locale
                        BaseLocaleConverter.java LocaleBeanUtils.java
                        LocaleConvertUtils.java LocaleConverter.java
                        package.html
               beanutils/src/java/org/apache/commons/beanutils/locale/converters
                        BigDecimalLocaleConverter.java
                        BigIntegerLocaleConverter.java
                        ByteLocaleConverter.java DateLocaleConverter.java
                        DecimalLocaleConverter.java
                        DoubleLocaleConverter.java
                        FloatLocaleConverter.java
                        IntegerLocaleConverter.java
                        LongLocaleConverter.java ShortLocaleConverter.java
                        SqlDateLocaleConverter.java
                        SqlTimeLocaleConverter.java
                        SqlTimestampLocaleConverter.java
                        StringLocaleConverter.java package.html
  Log:
  Added locale-aware analogues for standard beanutils classes. Submitted by Yauheny Mikulski.
  
  Revision  Changes    Path
  1.10      +13 -2     jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/package.html
  
  Index: package.html
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/package.html,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- package.html	13 Jul 2002 01:52:08 -0000	1.9
  +++ package.html	3 Sep 2002 21:34:20 -0000	1.10
  @@ -36,6 +36,7 @@
       <li><a href="#conversion.beanutils">BeanUtils and ConvertUtils
           Conversions</a></li>
       <li><a href="#conversion.defining">Defining Your Own Converters</a></li>
  +    <li><a href="#conversion.i18n">Locale Aware Conversions</a></li>
       </ul></li>
   </ol>
   
  @@ -197,7 +198,7 @@
       type is <code>java.util.List</code> (or an implementation of List) to be
       indexed as well.</li>
   <li><strong>Mapped</strong> - As an extension to standard JavaBeans APIs,
  -    the <em>BeanUtils></em> package considers any property whose underlying
  +    the <em>BeanUtils</em> package considers any property whose underlying
       value is a <code>java.util.Map</code> to be "mapped".  You can set and
       retrieve individual values via a String-valued key.</li>
   </ul>
  @@ -529,7 +530,7 @@
   <h3><code>BeanUtils</code> and <code>ConvertUtils</code> Conversions</h3>
   
   <p>A very common use case (and the situation that caused the initial creation
  -of the <em>BeanUtils</em> package was a desire to convert the set of request
  +of the <em>BeanUtils</em> package) was the desire to convert the set of request
   parameters that were included in a
   <code>javax.servlet.HttpServletRequest</code> received by a web application
   into a set of corresponding property setter calls on an arbitrary JavaBean.
  @@ -589,6 +590,16 @@
   <li>At application startup time, register an instance of your converter class
       by calling the <code>ConvertUtils.register()</code> method.</li>
   </ul>
  +
  +<a name="conversion.i18n"></a>
  +<h3>Locale Aware Conversions</h3>
  +<p>The standard classes in <code>org.apache.commons.beanutils</code> are not
  +locale aware. This gives them a cleaner interface and makes then easier to use
  +in situations where the locale is not important.</p>
  +<p>Extended, locale-aware analogues can be found in 
  +<code><a href='locale/package-summary.html'>org.apache.commons.beanutils.locale
  +</a></code>. These are built along the same
  +lines as the basic classes but support localization.</p>
   
   </body>
   </html>
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/BaseLocaleConverter.java
  
  Index: BaseLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/BaseLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale;
  
  import org.apache.commons.beanutils.ConversionException;
  
  import java.text.ParseException;
  import java.util.Locale;
  
  
  /**
   * <p>The base class for all standart type locale-sensitive converters.
   * It has {@link LocaleConverter} and {@link org.apache.commons.beanutils.Converter} implementations,
   * that convert an incoming locale-sensitive Object into an object of correspond type,
   * optionally using a default value or throwing a {@link ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public abstract class BaseLocaleConverter implements LocaleConverter {
  
      // ----------------------------------------------------- Instance Variables
  
      /** The default value specified to our Constructor, if any. */
      private Object defaultValue = null;
  
      /** Should we return the default value on conversion errors? */
      protected boolean useDefault = false;
  
      /** The locale specified to our Constructor, by default - system locale. */
      protected Locale locale = Locale.getDefault();
  
      /** The default pattern specified to our Constructor, if any. */
      protected String pattern = null;
  
      /** The flag indicating whether the given pattern string is localized or not. */
      protected boolean locPattern = false;
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link LocaleConverter} that will throw a {@link ConversionException}
       * if a conversion error occurs.
       * An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      protected BaseLocaleConverter(Locale locale, String pattern) {
  
          this(null, locale, pattern, false, false);
      }
  
      /**
       * Create a {@link LocaleConverter} that will throw a {@link ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      protected BaseLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          this(null, locale, pattern, false, locPattern);
      }
  
      /**
       * Create a {@link LocaleConverter} that will return the specified default value
       * if a conversion error occurs.
       * An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      protected BaseLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link LocaleConverter} that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      protected BaseLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          this(defaultValue, locale, pattern, true, locPattern);
      }
  
      /**
       * Create a {@link LocaleConverter} that will return the specified default value
       * or throw a {@link ConversionException} if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param useDefault    Indicate whether the default value is used or not
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      private BaseLocaleConverter(Object defaultValue, Locale locale,
                                  String pattern, boolean useDefault, boolean locPattern) {
  
          if (useDefault) {
              this.defaultValue = defaultValue;
              this.useDefault = true;
          }
  
          if (locale != null) {
              this.locale = locale;
          }
  
          this.pattern = pattern;
          this.locPattern = locPattern;
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
  
      abstract protected Object parse(Object value, String pattern) throws ParseException;
  
  
      /**
       * Convert the specified locale-sensitive input object into an output object.
       * The default pattern is used for the convertion.
       *
       * @param value The input object to be converted
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      public Object convert(Object value) {
          return convert(value, null);
      }
  
      /**
       * Convert the specified locale-sensitive input object into an output object.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      public Object convert(Object value, String pattern) {
          return convert(null, value, pattern);
      }
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type. The default pattern is used for the convertion.
       *
       * @param type Data type to which this value should be converted
       * @param value The input object to be converted
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      public Object convert(Class type, Object value) {
          return convert(type, value, null);
      }
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param type Data type to which this value should be converted
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      public Object convert(Class type, Object value, String pattern) {
          if (value == null) {
              if (useDefault) {
                  return (defaultValue);
              }
              else {
                  throw new ConversionException("No value specified");
              }
          }
  
          try {
              if (pattern != null) {
                  return parse(value, pattern);
              }
              else {
                  return parse(value, this.pattern);
              }
          }
          catch (Exception e) {
              if (useDefault) {
                  return (defaultValue);
              }
              else {
                  throw new ConversionException(e);
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleBeanUtils.java
  
  Index: LocaleBeanUtils.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleBeanUtils.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale;
  
  
  import org.apache.commons.beanutils.*;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import java.beans.IndexedPropertyDescriptor;
  import java.beans.PropertyDescriptor;
  import java.lang.reflect.InvocationTargetException;
  import java.util.Locale;
  
  
  /**
   * Utility methods for populating JavaBeans properties
   * via reflection in a locale-dependent manner.
   *
   * @author Craig R. McClanahan
   * @author Ralph Schaer
   * @author Chris Audley
   * @author Rey François
   * @author Gregor Raıman
   * @author Yauheny Mikulski
   */
  
  public class LocaleBeanUtils extends BeanUtils {
  
  
      // ----------------------------------------------------- Instance Variables
  
      /** All logging goes through this logger */
      private static Log log = LogFactory.getLog(LocaleBeanUtils.class);
  
      /**
       * getter for defaultLocale
       */
      public static Locale getDefaultLocale() {
  
          return LocaleConvertUtils.getDefaultLocale();
      }
  
  
      /**
       * setter for defaultLocale
       */
      public static void setDefaultLocale(Locale locale) {
  
          LocaleConvertUtils.setDefaultLocale(locale);
      }
  
      /**
       * getter for applyLocalized
       * (Indicate whether the pattern is localized or not)
       */
      public static boolean getApplyLocalized() {
  
          return LocaleConvertUtils.getApplyLocalized();
      }
  
      /**
       * setter for applyLocalized
       * (Indicate whether the pattern is localized or not)
       */
      public static void setApplyLocalized(boolean newApplyLocalized) {
  
          LocaleConvertUtils.setApplyLocalized(newApplyLocalized);
      }
  
  
      // --------------------------------------------------------- Public Methods
  
      /**
       * Return the value of the specified locale-sensitive indexed property
       * of the specified bean, as a String. The zero-relative index of the
       * required value must be included (in square brackets) as a suffix to
       * the property name, or <code>IllegalArgumentException</code> will be
       * thrown.
       *
       * @param bean Bean whose property is to be extracted
       * @param name <code>propertyname[index]</code> of the property value
       *  to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getIndexedProperty(Object bean, String name, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getIndexedProperty(bean, name);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
      /**
       * Return the value of the specified locale-sensitive indexed property
       * of the specified bean, as a String using the default convertion pattern of
       * the corresponding {@link LocaleConverter}. The zero-relative index
       * of the required value must be included (in square brackets) as a suffix
       * to the property name, or <code>IllegalArgumentException</code> will be thrown.
       *
       * @param bean Bean whose property is to be extracted
       * @param name <code>propertyname[index]</code> of the property value
       *  to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getIndexedProperty(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getIndexedProperty(bean, name, null);
      }
  
      /**
       * Return the value of the specified locale-sensetive indexed property
       * of the specified bean, as a String using the specified convertion pattern.
       * The index is specified as a method parameter and
       * must *not* be included in the property name expression
       *
       * @param bean Bean whose property is to be extracted
       * @param name Simple property name of the property value to be extracted
       * @param index Index of the property value to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getIndexedProperty(Object bean,
                                              String name, int index, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getIndexedProperty(bean, name, index);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
      /**
       * Return the value of the specified locale-sensetive indexed property
       * of the specified bean, as a String using the default convertion pattern of
       * the corresponding {@link LocaleConverter}.
       * The index is specified as a method parameter and
       * must *not* be included in the property name expression
       *
       * @param bean Bean whose property is to be extracted
       * @param name Simple property name of the property value to be extracted
       * @param index Index of the property value to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getIndexedProperty(Object bean,
                                              String name, int index)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
          return getIndexedProperty(bean, name, index, null);
      }
  
      /**
       * Return the value of the specified simple locale-sensitive property
       * of the specified bean, converted to a String using the specified
       * convertion pattern.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Name of the property to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getSimpleProperty(Object bean, String name, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getSimpleProperty(bean, name);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
      /**
       * Return the value of the specified simple locale-sensitive property
       * of the specified bean, converted to a String using the default
       * convertion pattern of the corresponding {@link LocaleConverter}.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Name of the property to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getSimpleProperty(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getSimpleProperty(bean, name, null);
      }
  
      /**
       * Return the value of the specified mapped locale-sensitive property
       * of the specified bean, as a String using the specified convertion pattern.
       * The key is specified as a method parameter and must *not* be included in
       * the property name expression.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Simple property name of the property value to be extracted
       * @param key Lookup key of the property value to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getMappedProperty(Object bean,
                                             String name, String key, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getMappedProperty(bean, name, key);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
      /**
       * Return the value of the specified mapped locale-sensitive property
       * of the specified bean, as a String
       * The key is specified as a method parameter and must *not* be included
       * in the property name expression
       *
       * @param bean Bean whose property is to be extracted
       * @param name Simple property name of the property value to be extracted
       * @param key Lookup key of the property value to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getMappedProperty(Object bean,
                                             String name, String key)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getMappedProperty(bean, name, key, null);
      }
  
  
      /**
       * Return the value of the specified locale-sensitive mapped property
       * of the specified bean, as a String using the specified pattern.
       * The String-valued key of the required value
       * must be included (in parentheses) as a suffix to
       * the property name, or <code>IllegalArgumentException</code> will be
       * thrown.
       *
       * @param bean Bean whose property is to be extracted
       * @param name <code>propertyname(index)</code> of the property value
       *  to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getMappedPropertyLocale(Object bean, String name, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getMappedProperty(bean, name);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
  
      /**
       * Return the value of the specified locale-sensitive mapped property
       * of the specified bean, as a String using the default
       * convertion pattern of the corresponding {@link LocaleConverter}.
       * The String-valued key of the required value
       * must be included (in parentheses) as a suffix to
       * the property name, or <code>IllegalArgumentException</code> will be
       * thrown.
       *
       * @param bean Bean whose property is to be extracted
       * @param name <code>propertyname(index)</code> of the property value
       *  to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getMappedProperty(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getMappedPropertyLocale(bean, name, null);
      }
  
      /**
       * Return the value of the (possibly nested) locale-sensitive property
       * of the specified name, for the specified bean,
       * as a String using the specified pattern.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Possibly nested name of the property to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception IllegalArgumentException if a nested reference to a
       *  property returns null
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getNestedProperty(Object bean, String name, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          Object value = PropertyUtils.getNestedProperty(bean, name);
          return LocaleConvertUtils.convert(value, pattern);
      }
  
      /**
       * Return the value of the (possibly nested) locale-sensitive property
       * of the specified name, for the specified bean, as a String using the default
       * convertion pattern of the corresponding {@link LocaleConverter}.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Possibly nested name of the property to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception IllegalArgumentException if a nested reference to a
       *  property returns null
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getNestedProperty(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getNestedProperty(bean, name, null);
      }
  
      /**
       * Return the value of the specified locale-sensitive property
       * of the specified bean, no matter which property reference
       * format is used, as a String using the specified convertion pattern.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Possibly indexed and/or nested name of the property
       *  to be extracted
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getProperty(Object bean, String name, String pattern)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getNestedProperty(bean, name, pattern);
      }
  
      /**
       * Return the value of the specified locale-sensitive property
       * of the specified bean, no matter which property reference
       * format is used, as a String using the default
       * convertion pattern of the corresponding {@link LocaleConverter}.
       *
       * @param bean Bean whose property is to be extracted
       * @param name Possibly indexed and/or nested name of the property
       *  to be extracted
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       * @exception NoSuchMethodException if an accessor method for this
       *  propety cannot be found
       */
      public static String getProperty(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException,
              NoSuchMethodException {
  
          return getNestedProperty(bean, name);
      }
  
      /**
       * Set the specified locale-sensitive property value, performing type
       * conversions as required to conform to the type of the destination property
       * using the default convertion pattern of the corresponding {@link LocaleConverter}.
       *
       * @param bean Bean on which setting is to be performed
       * @param name Property name (can be nested/indexed/mapped/combo)
       * @param value Value to be set
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       */
      public static void setProperty(Object bean, String name, Object value)
              throws IllegalAccessException, InvocationTargetException {
  
          setProperty(bean, name, value, null);
      }
  
      /**
       * Set the specified locale-sensitive property value, performing type
       * conversions as required to conform to the type of the destination
       * property using the specified convertion pattern.
       *
       * @param bean Bean on which setting is to be performed
       * @param name Property name (can be nested/indexed/mapped/combo)
       * @param value Value to be set
       * @param pattern The convertion pattern
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       */
      public static void setProperty(Object bean, String name, Object value, String pattern)
              throws IllegalAccessException, InvocationTargetException {
  
          // Trace logging (if enabled)
          if (log.isTraceEnabled()) {
              StringBuffer sb = new StringBuffer("  setProperty(");
              sb.append(bean);
              sb.append(", ");
              sb.append(name);
              sb.append(", ");
              if (value == null) {
                  sb.append("<NULL>");
              }
              else if (value instanceof String) {
                  sb.append((String) value);
              }
              else if (value instanceof String[]) {
                  String values[] = (String[]) value;
                  sb.append('[');
                  for (int i = 0; i < values.length; i++) {
                      if (i > 0) {
                          sb.append(',');
                      }
                      sb.append(values[i]);
                  }
                  sb.append(']');
              }
              else {
                  sb.append(value.toString());
              }
              sb.append(')');
              log.trace(sb.toString());
          }
  
          Descriptor propInfo = calculate(bean, name);
  
          if (propInfo != null) {
              Class type = definePropertyType(propInfo.getTarget(), name, propInfo.getPropName());
  
              if (type != null) {
  
                  Object newValue = convert(type, propInfo.getIndex(), value, pattern);
                  invokeSetter(propInfo.getTarget(), propInfo.getPropName(),
                          propInfo.getKey(), propInfo.getIndex(), newValue);
              }
          }
      }
  
      /**
       * Calculate the property type.
       *
       * @param target The bean
       * @param name The property name
       * @param propName The Simple name of target property
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       */
      protected static Class definePropertyType(Object target, String name, String propName)
              throws IllegalAccessException, InvocationTargetException {
  
          Class type = null;               // Java type of target property
  
          if (target instanceof DynaBean) {
              DynaClass dynaClass = ((DynaBean) target).getDynaClass();
              DynaProperty dynaProperty = dynaClass.getDynaProperty(propName);
              if (dynaProperty == null) {
                  return null; // Skip this property setter
              }
              type = dynaProperty.getType();
          }
          else {
              PropertyDescriptor descriptor = null;
              try {
                  descriptor =
                          PropertyUtils.getPropertyDescriptor(target, name);
                  if (descriptor == null) {
                      return null; // Skip this property setter
                  }
              }
              catch (NoSuchMethodException e) {
                  return null; // Skip this property setter
              }
              if (descriptor instanceof MappedPropertyDescriptor) {
                  type = ((MappedPropertyDescriptor) descriptor).
                          getMappedPropertyType();
              }
              else if (descriptor instanceof IndexedPropertyDescriptor) {
                  type = ((IndexedPropertyDescriptor) descriptor).
                          getIndexedPropertyType();
              }
              else {
                  type = descriptor.getPropertyType();
              }
          }
          return type;
      }
  
      /**
       * Convert the specified value to the required type using the
       * specified convertion pattern.
       *
       * @param type The Java type of target property
       * @param index The indexed subscript value (if any)
       * @param value The value to be converted
       * @param pattern The convertion pattern
       */
      protected static Object convert(Class type, int index, Object value, String pattern) {
  
          Object newValue = null;
  
          if (type.isArray() && (index < 0)) { // Scalar value into array
              if (value instanceof String) {
                  String values[] = new String[1];
                  values[0] = (String) value;
                  newValue = LocaleConvertUtils.convert((String[]) values, type, pattern);
              }
              else if (value instanceof String[]) {
                  newValue = LocaleConvertUtils.convert((String[]) value, type, pattern);
              }
              else {
                  newValue = value;
              }
          }
          else if (type.isArray()) {         // Indexed value into array
              if (value instanceof String) {
                  newValue = LocaleConvertUtils.convert((String) value,
                          type.getComponentType(), pattern);
              }
              else if (value instanceof String[]) {
                  newValue = LocaleConvertUtils.convert(((String[]) value)[0],
                          type.getComponentType(), pattern);
              }
              else {
                  newValue = value;
              }
          }
          else {                             // Value into scalar
              if (value instanceof String) {
                  newValue = LocaleConvertUtils.convert((String) value, type, pattern);
              }
              else if (value instanceof String[]) {
                  newValue = LocaleConvertUtils.convert(((String[]) value)[0],
                          type, pattern);
              }
              else {
                  newValue = value;
              }
          }
          return newValue;
      }
  
      /**
       *  Convert the specified value to the required type.
       *
       * @param type The Java type of target property
       * @param index The indexed subscript value (if any)
       * @param value The value to be converted
       */
      protected static Object convert(Class type, int index, Object value) {
  
          Object newValue = null;
  
          if (type.isArray() && (index < 0)) { // Scalar value into array
              if (value instanceof String) {
                  String values[] = new String[1];
                  values[0] = (String) value;
                  newValue = ConvertUtils.convert((String[]) values, type);
              }
              else if (value instanceof String[]) {
                  newValue = ConvertUtils.convert((String[]) value, type);
              }
              else {
                  newValue = value;
              }
          }
          else if (type.isArray()) {         // Indexed value into array
              if (value instanceof String) {
                  newValue = ConvertUtils.convert((String) value,
                          type.getComponentType());
              }
              else if (value instanceof String[]) {
                  newValue = ConvertUtils.convert(((String[]) value)[0],
                          type.getComponentType());
              }
              else {
                  newValue = value;
              }
          }
          else {                             // Value into scalar
              if (value instanceof String) {
                  newValue = ConvertUtils.convert((String) value, type);
              }
              else if (value instanceof String[]) {
                  newValue = ConvertUtils.convert(((String[]) value)[0],
                          type);
              }
              else {
                  newValue = value;
              }
          }
          return newValue;
      }
  
      /**
       * Invoke the setter method.
       *
       * @param target The bean
       * @param propName The Simple name of target property
       * @param key The Mapped key value (if any)
       * @param index The indexed subscript value (if any)
       * @param newValue The value to be set
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       */
      protected static void invokeSetter(Object target, String propName, String key, int index, Object newValue)
              throws IllegalAccessException, InvocationTargetException {
  
          try {
              if (index >= 0) {
                  PropertyUtils.setIndexedProperty(target, propName,
                          index, newValue);
              }
              else if (key != null) {
                  PropertyUtils.setMappedProperty(target, propName,
                          key, newValue);
              }
              else {
                  PropertyUtils.setProperty(target, propName, newValue);
              }
          }
          catch (NoSuchMethodException e) {
              throw new InvocationTargetException
                      (e, "Cannot set " + propName);
          }
      }
  
      /**
       * Resolve any nested expression to get the actual target bean.
       *
       * @param bean The bean
       * @param name The property name
       *
       * @exception IllegalAccessException if the caller does not have
       *  access to the property accessor method
       * @exception InvocationTargetException if the property accessor method
       *  throws an exception
       */
      protected static Descriptor calculate(Object bean, String name)
              throws IllegalAccessException, InvocationTargetException {
  
          String propName = null;          // Simple name of target property
          int index = -1;                  // Indexed subscript value (if any)
          String key = null;               // Mapped key value (if any)
  
          Object target = bean;
          int delim = name.lastIndexOf(PropertyUtils.NESTED_DELIM);
          if (delim >= 0) {
              try {
                  target =
                          PropertyUtils.getProperty(bean, name.substring(0, delim));
              }
              catch (NoSuchMethodException e) {
                  return null; // Skip this property setter
              }
              name = name.substring(delim + 1);
              if (log.isTraceEnabled()) {
                  log.trace("    Target bean = " + target);
                  log.trace("    Target name = " + name);
              }
          }
  
          // Calculate the property name, index, and key values
          propName = name;
          int i = propName.indexOf(PropertyUtils.INDEXED_DELIM);
          if (i >= 0) {
              int k = propName.indexOf(PropertyUtils.INDEXED_DELIM2);
              try {
                  index =
                          Integer.parseInt(propName.substring(i + 1, k));
              }
              catch (NumberFormatException e) {
                  ;
              }
              propName = propName.substring(0, i);
          }
          int j = propName.indexOf(PropertyUtils.MAPPED_DELIM);
          if (j >= 0) {
              int k = propName.indexOf(PropertyUtils.MAPPED_DELIM2);
              try {
                  key = propName.substring(j + 1, k);
              }
              catch (IndexOutOfBoundsException e) {
                  ;
              }
              propName = propName.substring(0, j);
          }
          return new Descriptor(target, name, propName, key, index);
      }
  
      protected static class Descriptor {
  
          private int index = -1;    // Indexed subscript value (if any)
          private String name;
          private String propName;   // Simple name of target property
          private String key;        // Mapped key value (if any)
          private Object target;
  
          public Descriptor(Object target, String name, String propName, String key, int index) {
  
              setTarget(target);
              setName(name);
              setPropName(propName);
              setKey(key);
              setIndex(index);
          }
  
          public Object getTarget() {
              return target;
          }
  
          public void setTarget(Object target) {
              this.target = target;
          }
  
          public String getKey() {
              return key;
          }
  
          public void setKey(String key) {
              this.key = key;
          }
  
          public int getIndex() {
              return index;
          }
  
          public void setIndex(int index) {
              this.index = index;
          }
  
          public String getName() {
              return name;
          }
  
          public void setName(String name) {
              this.name = name;
          }
  
          public String getPropName() {
              return propName;
          }
  
          public void setPropName(String propName) {
              this.propName = propName;
          }
      }
  }
  
  
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleConvertUtils.java
  
  Index: LocaleConvertUtils.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleConvertUtils.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale;
  
  import org.apache.commons.beanutils.locale.converters.*;
  import org.apache.commons.collections.FastHashMap;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  import java.lang.reflect.Array;
  import java.math.BigDecimal;
  import java.math.BigInteger;
  import java.sql.Date;
  import java.sql.Time;
  import java.sql.Timestamp;
  import java.util.Locale;
  
  /**
   * <p>Utility methods for converting locale-sensitive String scalar values to objects of the
   * specified Class, String arrays to arrays of the specified Class and
   * object to locale-sensitive String scalar value.
   *
   * The actual {@link LocaleConverter} instance to be used
   * can be registered for each possible destination Class. Unless you override them, standard
   * {@link LocaleConverter} instances are provided for all of the following
   * destination Classes:</p>
   * <ul>
   * <li>java.lang.BigDecimal</li>
   * <li>java.lang.BigInteger</li>
   * <li>byte and java.lang.Byte</li>
   * <li>double and java.lang.Double</li>
   * <li>float and java.lang.Float</li>
   * <li>int and java.lang.Integer</li>
   * <li>long and java.lang.Long</li>
   * <li>short and java.lang.Short</li>
   * <li>java.lang.String</li>
   * <li>java.sql.Date</li>
   * <li>java.sql.Time</li>
   * <li>java.sql.Timestamp</li>
   * </ul>
   *
   * <p>For backwards compatibility, the standard locale converters
   * for primitive types (and the corresponding wrapper classes).
   *
   * If you prefer to have another {@link LocaleConverter}
   * thrown instead, replace the standard {@link LocaleConverter} instances
   * with ones created with the one of the appropriate constructors.
   *
   * It's important that {@link LocaleConverter} should be registered for
   * the specified locale and Class (or primitive type).
   *
   * @author Yauheny Mikulski
   */
  public class LocaleConvertUtils {
  
      // ----------------------------------------------------- Instance Variables
  
      /** The locale - default for convertion. */
      private static Locale defaultLocale = Locale.getDefault();
  
      /**
       * getter for defaultLocale
       */
      public static Locale getDefaultLocale() {
  
          return defaultLocale;
      }
  
      /**
       * setter for defaultLocale
       */
      public static void setDefaultLocale(Locale locale) {
  
          if (locale == null) {
              defaultLocale = Locale.getDefault();
          }
          else {
              defaultLocale = locale;
          }
      }
  
      /** Indicate whether the pattern is localized or not */
      private static boolean applyLocalized = false;
  
      /**
       * getter for applyLocalized
       */
      public static boolean getApplyLocalized() {
          return applyLocalized;
      }
  
      /**
       * setter for applyLocalized
       */
      public static void setApplyLocalized(boolean newApplyLocalized) {
          applyLocalized = newApplyLocalized;
      }
  
      /** The <code>Log</code> instance for this class. */
      private static Log log = LogFactory.getLog(LocaleConvertUtils.class);
  
      /** Every entry of the mapConverters is:
       *  key = locale
       *  value = FastHashMap of converters for the certain locale.
       */
      private static FastHashMap mapConverters = new FastHashMap();
  
      /**
       * This code makes the state by default (deregisters all converters for all locales)
       *  and then registers default locale converters.
       */
      static {
          deregister();
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive value into a String.
       *
       * @param value The Value to be converted
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static String convert(Object value) {
          return convert(value, defaultLocale, null);
      }
  
      /**
       * Convert the specified locale-sensitive value into a String
       * using the convertion pattern.
       *
       * @param value The Value to be converted
       * @param pattern       The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static String convert(Object value, String pattern) {
          return convert(value, defaultLocale, pattern);
      }
  
      /**
       * Convert the specified locale-sensitive value into a String
       * using the paticular convertion pattern.
       *
       * @param value The Value to be converted
       * @param locale The locale
       * @param pattern The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static String convert(Object value, Locale locale, String pattern) {
  
          LocaleConverter converter = lookup(String.class, locale);
  
          return (String) converter.convert(String.class, value, pattern);
      }
  
      /**
       * Convert the specified value to an object of the specified class (if
       * possible).  Otherwise, return a String representation of the value.
       *
       * @param value The String scalar value to be converted
       * @param clazz The Data type to which this value should be converted.
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static Object convert(String value, Class clazz) {
  
          return convert(value, clazz, defaultLocale, null);
      }
  
      /**
       * Convert the specified value to an object of the specified class (if
       * possible) using the convertion pattern. Otherwise, return a String
       * representation of the value.
       *
       * @param value The String scalar value to be converted
       * @param clazz The Data type to which this value should be converted.
       * @param pattern The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static Object convert(String value, Class clazz, String pattern) {
  
          return convert(value, clazz, defaultLocale, pattern);
      }
  
      /**
       * Convert the specified value to an object of the specified class (if
       * possible) using the convertion pattern. Otherwise, return a String
       * representation of the value.
       *
       * @param value The String scalar value to be converted
       * @param clazz The Data type to which this value should be converted.
       * @param locale The locale
       * @param pattern The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static Object convert(String value, Class clazz, Locale locale, String pattern) {
  
          if (log.isDebugEnabled()) {
              log.debug("Convert string " + value + " to class " +
                      clazz.getName() + " using " + locale.toString() +
                      " locale and " + pattern + " pattern");
          }
  
          LocaleConverter converter = lookup(clazz, locale);
  
          if (converter == null) {
              converter = (LocaleConverter) lookup(String.class, locale);
          }
          if (log.isTraceEnabled()) {
              log.trace("  Using converter " + converter);
          }
  
          return (converter.convert(clazz, value, pattern));
      }
  
      /**
       * Convert an array of specified values to an array of objects of the
       * specified class (if possible) using the convertion pattern.
       *
       * @param values Value to be converted (may be null)
       * @param clazz Java array or element class to be converted to
       * @param pattern The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static Object convert(String values[], Class clazz, String pattern) {
  
          return convert(values, clazz, getDefaultLocale(), pattern);
      }
  
      /**
       * Convert an array of specified values to an array of objects of the
       * specified class (if possible) using the convertion pattern.
       *
       * @param values Value to be converted (may be null)
       * @param clazz Java array or element class to be converted to
       * @param locale The locale
       * @param pattern The convertion pattern
       *
       * @exception ConversionException if thrown by an underlying Converter
       */
      public static Object convert(String values[], Class clazz, Locale locale, String pattern) {
  
          Class type = clazz;
          if (clazz.isArray()) {
              type = clazz.getComponentType();
          }
          if (log.isDebugEnabled()) {
              log.debug("Convert String[" + values.length + "] to class " +
                      type.getName() + "[] using " + locale.toString() +
                      " locale and " + pattern + " pattern");
          }
  
          Object array = Array.newInstance(type, values.length);
          for (int i = 0; i < values.length; i++) {
              Array.set(array, i, convert(values[i], type, locale, pattern));
          }
  
          return (array);
      }
  
      /**
       * Register a custom {@link LocaleConverter} for the specified destination
       * <code>Class</code>, replacing any previously registered converter.
       *
       * @param converter The LocaleConverter to be registered
       * @param clazz The Destination class for conversions performed by this
       *  Converter
       * @param locale The locale
       */
      public static void register(LocaleConverter converter, Class clazz, Locale locale) {
  
          lookup(locale).put(clazz, converter);
      }
  
      /**
       * Remove any registered {@link LocaleConverter}.
       */
      public static void deregister() {
  
          FastHashMap defaultConverter = lookup(defaultLocale);
  
          mapConverters.setFast(false);
  
          mapConverters.clear();
          mapConverters.put(defaultLocale, defaultConverter);
  
          mapConverters.setFast(true);
      }
  
  
      /**
       * Remove any registered {@link LocaleConverter} for the specified locale
       *
       * @param locale The locale
       */
      public static void deregister(Locale locale) {
  
          mapConverters.remove(locale);
      }
  
  
      /**
       * Remove any registered {@link LocaleConverter} for the specified locale and Class.
       *
       * @param clazz Class for which to remove a registered Converter
       * @param locale The locale
       */
      public static void deregister(Class clazz, Locale locale) {
  
          lookup(locale).remove(clazz);
      }
  
      /**
       * Look up and return any registered {@link LocaleConverter} for the specified
       * destination class and locale; if there is no registered Converter, return
       * <code>null</code>.
       *
       * @param clazz Class for which to return a registered Converter
       * @param locale The Locale
       */
      public static LocaleConverter lookup(Class clazz, Locale locale) {
  
          return (LocaleConverter) lookup(locale).get(clazz);
      }
  
      /**
       * Look up and return any registered FastHashMap instance for the specified locale;
       * if there is no registered one, return <code>null</code>.
       *
       * @param locale The Locale
       * @return The FastHashMap instance contains the all {@LocaleConverter} types for
       *  the specified locale.
       */
      protected static FastHashMap lookup(Locale locale) {
          FastHashMap localeConverters;
  
          if (locale == null) {
              localeConverters = (FastHashMap) mapConverters.get(defaultLocale);
          }
          else {
              localeConverters = (FastHashMap) mapConverters.get(locale);
  
              if (localeConverters == null) {
                  localeConverters = create(locale);
                  mapConverters.put(locale, localeConverters);
              }
          }
  
          return localeConverters;
      }
  
      /**
       *  Create all {@link LocaleConverter} types for specified locale.
       *
       * @param locale The Locale
       * @return The FastHashMap instance contains the all {@LocaleConverter} types
       *  for the specified locale.
       */
      protected static FastHashMap create(Locale locale) {
  
          FastHashMap converter = new FastHashMap();
          converter.setFast(false);
  
          converter.put(BigDecimal.class, new BigDecimalLocaleConverter(locale, applyLocalized));
          converter.put(BigInteger.class, new BigIntegerLocaleConverter(locale, applyLocalized));
  
          converter.put(Byte.class, new ByteLocaleConverter(locale, applyLocalized));
          converter.put(Byte.TYPE, new ByteLocaleConverter(locale, applyLocalized));
  
          converter.put(Double.class, new DoubleLocaleConverter(locale, applyLocalized));
          converter.put(Double.TYPE, new DoubleLocaleConverter(locale, applyLocalized));
  
          converter.put(Float.class, new FloatLocaleConverter(locale, applyLocalized));
          converter.put(Float.TYPE, new FloatLocaleConverter(locale, applyLocalized));
  
          converter.put(Integer.class, new IntegerLocaleConverter(locale, applyLocalized));
          converter.put(Integer.TYPE, new IntegerLocaleConverter(locale, applyLocalized));
  
          converter.put(Long.class, new LongLocaleConverter(locale, applyLocalized));
          converter.put(Long.TYPE, new LongLocaleConverter(locale, applyLocalized));
  
          converter.put(Short.class, new ShortLocaleConverter(locale, applyLocalized));
          converter.put(Short.TYPE, new ShortLocaleConverter(locale, applyLocalized));
  
          converter.put(String.class, new StringLocaleConverter(locale, applyLocalized));
  
          converter.put(Date.class, new SqlDateLocaleConverter(locale, applyLocalized));
          converter.put(Time.class, new SqlTimeLocaleConverter(locale, applyLocalized));
          converter.put(Timestamp.class, new SqlTimestampLocaleConverter(locale, applyLocalized));
  
          converter.setFast(true);
  
          return converter;
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleConverter.java
  
  Index: LocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/LocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale;
  
  import org.apache.commons.beanutils.Converter;
  
  
  /**
   * <p>General purpose locale-sensitive data type converter that can be registered and used
   * within the BeanUtils package to manage the conversion of objects from
   * one type to another.
   *
   * @author Yauheny Mikulski
   */
  
  public interface LocaleConverter extends Converter {
  
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param type Data type to which this value should be converted
       * @param value The input value to be converted
       * @param pattern The user-defined pattern is used for the input object formatting.
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      public Object convert(Class type, Object value, String pattern);
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  <title>Package Documentation for org.apache.commons.beanutils.locale Package</title>
  </head>
  <body bgcolor="white">
  <p>Locale-aware extensions of the standard beanutils classes. 
  This package allows locale-dependent population of JavaBean's.</p>
  
  </body>
  </html>
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverter.java
  
  Index: BigDecimalLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/BigDecimalLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.math.BigDecimal</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class BigDecimalLocaleConverter extends DecimalLocaleConverter {
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public BigDecimalLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public BigDecimalLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public BigDecimalLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public BigDecimalLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public BigDecimalLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public BigDecimalLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigDecimalLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverter.java
  
  Index: BigIntegerLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/BigIntegerLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.math.BigInteger</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class BigIntegerLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public BigIntegerLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public BigIntegerLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public BigIntegerLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public BigIntegerLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public BigIntegerLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public BigIntegerLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public BigIntegerLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverter.java
  
  Index: ByteLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/ByteLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Byte</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class ByteLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public ByteLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public ByteLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public ByteLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public ByteLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public ByteLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public ByteLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ByteLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverter.java
  
  Index: DateLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DateLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import org.apache.commons.beanutils.locale.BaseLocaleConverter;
  
  import java.text.ParseException;
  import java.text.ParsePosition;
  import java.text.SimpleDateFormat;
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.util.Date</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class DateLocaleConverter extends BaseLocaleConverter {
  
      // ----------------------------------------------------- Instance Variables
  
      /** The Date formatter */
      private SimpleDateFormat formatter = new SimpleDateFormat(pattern, locale);
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public DateLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public DateLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DateLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public DateLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public DateLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DateLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DateLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          if (locPattern) {
              formatter.applyLocalizedPattern(pattern);
          }
          else {
              formatter.applyPattern(pattern);
          }
  
          return formatter.parse((String) value, new ParsePosition(0));
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DecimalLocaleConverter.java
  
  Index: DecimalLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DecimalLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import org.apache.commons.beanutils.locale.BaseLocaleConverter;
  
  import java.text.DecimalFormat;
  import java.text.ParseException;
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Decimal</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class DecimalLocaleConverter extends BaseLocaleConverter {
  
  
      // ----------------------------------------------------- Instance Variables
  
      /** The Decimal formatter */
      private DecimalFormat formatter = (DecimalFormat) DecimalFormat.getInstance(locale);
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public DecimalLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public DecimalLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DecimalLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public DecimalLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public DecimalLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DecimalLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DecimalLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          if (locPattern) {
              formatter.applyLocalizedPattern(pattern);
          }
          else {
              formatter.applyPattern(pattern);
          }
  
          return formatter.parse((String) value);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverter.java
  
  Index: DoubleLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/DoubleLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Double</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class DoubleLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public DoubleLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public DoubleLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DoubleLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public DoubleLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public DoubleLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public DoubleLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public DoubleLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java
  
  Index: FloatLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/FloatLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.math.BigDecimal</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class FloatLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public FloatLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public FloatLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public FloatLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public FloatLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public FloatLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public FloatLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public FloatLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverter.java
  
  Index: IntegerLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/IntegerLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Integer</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class IntegerLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
  
      public IntegerLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public IntegerLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public IntegerLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public IntegerLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public IntegerLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public IntegerLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public IntegerLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverter.java
  
  Index: LongLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/LongLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Long</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class LongLocaleConverter extends DecimalLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public LongLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public LongLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public LongLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public LongLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public LongLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public LongLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public LongLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverter.java
  
  Index: ShortLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/ShortLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.lang.Short</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class ShortLocaleConverter extends DecimalLocaleConverter {
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public ShortLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public ShortLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public ShortLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public ShortLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public ShortLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public ShortLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public ShortLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern);
      }
  }
  
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlDateLocaleConverter.java
  
  Index: SqlDateLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlDateLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.sql.Date;
  import java.text.ParseException;
  import java.util.Locale;
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.sql.Date</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class SqlDateLocaleConverter extends DateLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public SqlDateLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public SqlDateLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlDateLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public SqlDateLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public SqlDateLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlDateLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlDateLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          return new Date(((java.util.Date) super.parse((String) value, pattern)).getTime());
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlTimeLocaleConverter.java
  
  Index: SqlTimeLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlTimeLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.sql.Time;
  import java.text.ParseException;
  import java.util.Locale;
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.sql.Time</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class SqlTimeLocaleConverter extends DateLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public SqlTimeLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public SqlTimeLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlTimeLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public SqlTimeLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public SqlTimeLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlTimeLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimeLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          return new Time(((java.util.Date) super.parse((String) value, pattern)).getTime());
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlTimestampLocaleConverter.java
  
  Index: SqlTimestampLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/SqlTimestampLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package org.apache.commons.beanutils.locale.converters;
  
  import java.sql.Timestamp;
  import java.text.ParseException;
  import java.util.Locale;
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive String into a <code>java.sql.Timestamp</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class SqlTimestampLocaleConverter extends DateLocaleConverter {
  
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public SqlTimestampLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public SqlTimestampLocaleConverter(Locale locale) {
  
          this(locale, (String) null);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlTimestampLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public SqlTimestampLocaleConverter(Object defaultValue) {
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public SqlTimestampLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public SqlTimestampLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public SqlTimestampLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          return new Timestamp(((java.util.Date) super.parse(value, pattern)).getTime());
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/StringLocaleConverter.java
  
  Index: StringLocaleConverter.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/StringLocaleConverter.java,v 1.1 2002/09/03 21:34:20 rdonkin Exp $
   * $Revision: 1.1 $
   * $Date: 2002/09/03 21:34:20 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
   
  package org.apache.commons.beanutils.locale.converters;
  
  import org.apache.commons.beanutils.locale.BaseLocaleConverter;
  
  import java.math.BigDecimal;
  import java.math.BigInteger;
  import java.text.DecimalFormat;
  import java.text.NumberFormat;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Locale;
  
  
  /**
   * <p>Standard {@link org.apache.commons.beanutils.locale.LocaleConverter} 
   * implementation that converts an incoming
   * locale-sensitive object into a <code>java.lang.String</code> object,
   * optionally using a default value or throwing a 
   * {@link org.apache.commons.beanutils.ConversionException}
   * if a conversion error occurs.</p>
   *
   * @author Yauheny Mikulski
   */
  
  public class StringLocaleConverter extends BaseLocaleConverter {
  
      // ----------------------------------------------------------- Constructors
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       */
      public StringLocaleConverter() {
  
          this(false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(boolean locPattern) {
  
          this(Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       */
      public StringLocaleConverter(Locale locale) {
  
          this(locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(Locale locale, boolean locPattern) {
  
          this(locale, (String) null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public StringLocaleConverter(Locale locale, String pattern) {
  
          this(locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will throw a {@link org.apache.commons.beanutils.ConversionException}
       * if a conversion error occurs.
       *
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(Locale locale, String pattern, boolean locPattern) {
  
          super(locale, pattern, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine and an unlocalized pattern is used
       * for the convertion.
       *
       * @param defaultValue  The default value to be returned
       */
      public StringLocaleConverter(Object defaultValue) {
  
          this(defaultValue, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. The locale is the default locale for
       * this instance of the Java Virtual Machine.
       *
       * @param defaultValue  The default value to be returned
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(Object defaultValue, boolean locPattern) {
  
          this(defaultValue, Locale.getDefault(), locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       */
      public StringLocaleConverter(Object defaultValue, Locale locale) {
  
          this(defaultValue, locale, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(Object defaultValue, Locale locale, boolean locPattern) {
  
          this(defaultValue, locale, null, locPattern);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs. An unlocalized pattern is used for the convertion.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       */
      public StringLocaleConverter(Object defaultValue, Locale locale, String pattern) {
  
          this(defaultValue, locale, pattern, false);
      }
  
      /**
       * Create a {@link org.apache.commons.beanutils.locale.LocaleConverter} 
       * that will return the specified default value
       * if a conversion error occurs.
       *
       * @param defaultValue  The default value to be returned
       * @param locale        The locale
       * @param pattern       The convertion pattern
       * @param locPattern    Indicate whether the pattern is localized or not
       */
      public StringLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern) {
  
          super(defaultValue, locale, pattern, locPattern);
      }
  
      // --------------------------------------------------------- Methods
  
      /**
       * Convert the specified locale-sensitive input object into an output object of the
       * specified type.
       *
       * @param value The input object to be converted
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      protected Object parse(Object value, String pattern) throws ParseException {
  
          String result = null;
  
          if ((value instanceof Integer) ||
                  (value instanceof Long) ||
                  (value instanceof BigInteger) ||
                  (value instanceof Byte) ||
                  (value instanceof Short)) {
  
              result = getDecimalFormat(locale, pattern).format(((Number) value).longValue());
          }
          else if ((value instanceof Double) ||
                  (value instanceof BigDecimal) ||
                  (value instanceof Float)) {
  
              result = getDecimalFormat(locale, pattern).format(((Number) value).doubleValue());
          }
          else if (value instanceof Date) { // java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp
  
              SimpleDateFormat dateFormat =
                      new SimpleDateFormat(pattern, locale);
  
              result = dateFormat.format(value);
          }
          else {
              result = value.toString();
          }
  
          return result;
      }
  
      /**
       * Make an instance of DecimalFormat.
       *
       * @param locale The locale
       * @param pattern The pattern is used for the convertion
       *
       * @exception ConversionException if conversion cannot be performed
       *  successfully
       */
      private DecimalFormat getDecimalFormat(Locale locale, String pattern) {
  
          DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getInstance(locale);
  
          if (locPattern) {
              numberFormat.applyLocalizedPattern(pattern);
          }
          else {
              numberFormat.applyPattern(pattern);
          }
  
          return numberFormat;
      }
  }
  
  
  
  1.1                  jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/locale/converters/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  <title>Package Documentation for org.apache.commons.beanutils.locale.converters</title>
  </head>
  <body bgcolor="white">
  <p>Standard implementations of the locale-aware
  <a href="../LocaleConverter.html">Converter</a>
  interface that are pre-registered with locale-aware
  <a href="../LocaleConvertUtils.html">ConvertUtils</a>
  at startup time.</p>
  </body>
  </html>
  
  
  

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


Mime
View raw message