nl.openedge.baritus.converters
Class BaseLocaleConverter

java.lang.Object
  extended bynl.openedge.baritus.converters.BaseLocaleConverter
All Implemented Interfaces:
Converter, Formatter, LocaleConverter
Direct Known Subclasses:
DateLocaleConverter, DecimalLocaleConverter

public abstract class BaseLocaleConverter
extends java.lang.Object
implements LocaleConverter, Formatter

base class for localized converters

Author:
Eelco Hillenius

Field Summary
protected  java.util.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  java.lang.String pattern
          The default pattern specified to our Constructor, if any.
 
Constructor Summary
protected BaseLocaleConverter(java.util.Locale locale, java.lang.String pattern)
          Create a LocaleConverter that will throw a ConversionException if a conversion error occurs.
protected BaseLocaleConverter(java.util.Locale locale, java.lang.String pattern, boolean locPattern)
          Create a LocaleConverter that will throw a ConversionException if an conversion error occurs.
 
Method Summary
 java.lang.Object convert(java.lang.Class type, java.lang.Object value)
          Convert the specified locale-sensitive input object into an output object of the specified type.
 java.lang.Object convert(java.lang.Object value)
          Convert the specified locale-sensitive input object into an output object.
 java.lang.Object convert(java.lang.Object value, java.lang.String pattern)
          Convert the specified locale-sensitive input object into an output object.
 java.util.Locale getLocale()
          get the locale
 java.lang.String getPattern()
          get the pattern
protected abstract  java.lang.Object parse(java.lang.Object value, java.lang.String pattern)
          Convert the specified locale-sensitive input object into an output object of the specified type.
 void setLocale(java.util.Locale locale)
          set the locale
 void setPattern(java.lang.String string)
          set the pattern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.openedge.baritus.converters.LocaleConverter
convert
 
Methods inherited from interface nl.openedge.baritus.converters.Formatter
format
 

Field Detail

locale

protected java.util.Locale locale
The locale specified to our Constructor, by default - system locale.


pattern

protected java.lang.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(java.util.Locale locale,
                              java.lang.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(java.util.Locale locale,
                              java.lang.String pattern,
                              boolean locPattern)
Create a LocaleConverter that will throw a ConversionException if an conversion error occurs.

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

parse

protected abstract java.lang.Object parse(java.lang.Object value,
                                          java.lang.String pattern)
                                   throws java.text.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
Throws:
ConversionException - if conversion cannot be performed successfully
java.text.ParseException

convert

public java.lang.Object convert(java.lang.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
Throws:
ConversionException - if conversion cannot be performed successfully

convert

public java.lang.Object convert(java.lang.Object value,
                                java.lang.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
Throws:
ConversionException - if conversion cannot be performed successfully

convert

public java.lang.Object convert(java.lang.Class type,
                                java.lang.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
Throws:
ConversionException - if conversion cannot be performed successfully

getLocale

public java.util.Locale getLocale()
get the locale

Returns:
Locale

getPattern

public java.lang.String getPattern()
get the pattern

Returns:
String

setLocale

public void setLocale(java.util.Locale locale)
set the locale

Parameters:
locale -

setPattern

public void setPattern(java.lang.String string)
set the pattern

Parameters:
string -


Copyright © 2003-2004 Open Edge. All Rights Reserved.