Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.beanutils.locale
Class BaseLocaleConverter

    java.lang.Object
      org.apache.commons.beanutils.locale.BaseLocaleConverter

All Implemented Interfaces:
  Converter, LocaleConverter

Direct Known Subclasses:
  DateLocaleConverter, DecimalLocaleConverter, StringLocaleConverter

    public abstract class BaseLocaleConverter

extends Object
implements LocaleConverter

The base class for all standart type locale-sensitive converters. It has `LocaleConverter` and `Converter` implementations, that convert an incoming locale-sensitive Object into an object of correspond type, optionally using a default value or throwing a `ConversionException` if a conversion error occurs.

Author:
  Yauheny Mikulski

Field Summary
`protected Locale` | `locale` The locale specified to our Constructor, by default - system locale.
`protected boolean` | `locPattern` The flag indicating whether the given pattern string is localized or not.
`protected String` | `pattern` The default pattern specified to our Constructor, if any.
`protected boolean` | `useDefault` Should we return the default value on conversion errors?

Constructor Summary
`protected` | `BaseLocaleConverter(Locale locale, String pattern)` Create a `LocaleConverter` that will throw a `ConversionException` if a conversion error occurs.
`protected` | `BaseLocaleConverter(Locale locale, String pattern, boolean locPattern)` Create a `LocaleConverter` that will throw a `ConversionException` if a conversion error occurs.
`protected` | `BaseLocaleConverter(Object defaultValue, Locale locale, String pattern)` Create a `LocaleConverter` that will return the specified default value if a conversion error occurs.
`protected` | `BaseLocaleConverter(Object defaultValue, Locale locale, String pattern, boolean locPattern)` Create a `LocaleConverter` that will return the specified default value if a conversion error occurs.

Method Summary
`Object` | `convert(Class type, Object value)` Convert the specified locale-sensitive input object into an output object of the specified type.
`Object` | `convert(Class type, Object value, String pattern)` Convert the specified locale-sensitive input object into an output object of the specified type.
`Object` | `convert(Object value)` Convert the specified locale-sensitive input object into an output object.
`Object` | `convert(Object value, String pattern)` Convert the specified locale-sensitive input object into an output object.
`protected abstract Object` | `parse(Object value, String pattern)` Convert the specified locale-sensitive input object into an output object of the specified type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### useDefault

    protected boolean useDefault

  Should we return the default value on conversion errors?

### locale

    protected Locale locale

  The locale specified to our Constructor, by default - system locale.

### pattern

    protected String pattern

  The default pattern specified to our Constructor, if any.

### locPattern

    protected boolean locPattern

  The flag indicating whether the given pattern string is localized or not.

Constructor Detail

### BaseLocaleConverter

    protected BaseLocaleConverter(Locale locale,
                                  String pattern)

  Create a `LocaleConverter` that will throw a `ConversionException` if a conversion error occurs. An unlocalized pattern is used for the convertion.

  Parameters:
    `locale` - The locale
    `pattern` - The convertion pattern

### BaseLocaleConverter

    protected BaseLocaleConverter(Locale locale,
                                  String pattern,
                                  boolean locPattern)

  Create a `LocaleConverter` that will throw a `ConversionException` if a conversion error occurs.

  Parameters:
    `locale` - The locale
    `pattern` - The convertion pattern
    `locPattern` - Indicate whether the pattern is localized or not

### BaseLocaleConverter

    protected BaseLocaleConverter(Object defaultValue,
                                  Locale locale,
                                  String pattern)

  Create a `LocaleConverter` that will return the specified default value if a conversion error occurs. An unlocalized pattern is used for the convertion.

  Parameters:
    `defaultValue` - The default value to be returned
    `locale` - The locale
    `pattern` - The convertion pattern

### BaseLocaleConverter

    protected BaseLocaleConverter(Object defaultValue,
                                  Locale locale,
                                  String pattern,
                                  boolean locPattern)

  Create a `LocaleConverter` that will return the specified default value if a conversion error occurs.

  Parameters:
    `defaultValue` - The default value to be returned
    `locale` - The locale
    `pattern` - The convertion pattern
    `locPattern` - Indicate whether the pattern is localized or not

Method Detail

### parse

    protected abstract Object parse(Object value,
                                    String pattern)
                             throws ParseException

  Convert the specified locale-sensitive input object into an output object of the specified type.

  Parameters:
    `value` - The input object to be converted
    `pattern` - The pattern is used for the convertion
  Returns:
    The converted value
  Throws:
    `ParseException` - if conversion cannot be performed successfully

### convert

    public Object convert(Object value)

  Convert the specified locale-sensitive input object into an output object. The default pattern is used for the convertion.

  Parameters:
    `value` - The input object to be converted
  Returns:
    The converted value
  Throws:
    `ConversionException` - if conversion cannot be performed successfully

### convert

    public Object convert(Object value,
                          String pattern)

  Convert the specified locale-sensitive input object into an output object.

  Parameters:
    `value` - The input object to be converted
    `pattern` - The pattern is used for the convertion
  Returns:
    The converted value
  Throws:
    `ConversionException` - if conversion cannot be performed successfully

### convert

    public Object convert(Class type,
                          Object value)

  Convert the specified locale-sensitive input object into an output object of the specified type. The default pattern is used for the convertion.

  Specified by:
    `convert` in interface `Converter`
  Parameters:
    `type` - Data type to which this value should be converted
    `value` - The input object to be converted
  Returns:
    The converted value
  Throws:
    `ConversionException` - if conversion cannot be performed successfully

### convert

    public Object convert(Class type,
                          Object value,
                          String pattern)

  Convert the specified locale-sensitive input object into an output object of the specified type.

  Specified by:
    `convert` in interface `LocaleConverter`
  Parameters:
    `type` - Data is type to which this value should be converted
    `value` - is the input object to be converted
    `pattern` - is the pattern is used for the conversion; if null is passed then the default pattern associated with the converter object will be used.
  Returns:
    The converted value
  Throws:
    `ConversionException` - if conversion cannot be performed successfully

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2009 The Apache Software Foundation. All Rights Reserved.