org.chwf.i18n
Class Localizer

java.lang.Object
  |
  +--org.chwf.i18n.Localizer

public abstract class Localizer
extends java.lang.Object

Class with static localizer methods. They derive the locale from UserLocale.getLocale().

Author:
Paul Strack

Method Summary
static java.lang.String format(java.lang.String pattern, java.lang.Object[] args)
          Format message pattern using arguments.
static java.lang.String formatCurrency(java.lang.Number number)
          Format currency as string.
static java.lang.String formatDate(java.util.Date date)
          Format date as string.
static java.lang.String formatDateTime(java.util.Date date)
          Format date-time as string.
static java.lang.String formatLongDate(java.util.Date date)
          Format date as string.
static java.lang.String formatNumber(java.lang.Number number)
          Format number as string.
static java.lang.String formatTime(java.util.Date date)
          Format time as string.
static java.lang.Number parseCurrency(java.lang.String value)
          Parse the string value as a currency.
static java.util.Date parseDate(java.lang.String value)
          Parse the string value as a date.
static java.util.Date parseDateTime(java.lang.String value)
          Parse the string value as a date-time.
static java.lang.Number parseNumber(java.lang.String value)
          Parse the string value as a number.
static java.util.Date parseTime(java.lang.String value)
          Parse the string value as a time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

format

public static java.lang.String format(java.lang.String pattern,
                                      java.lang.Object[] args)
Format message pattern using arguments.

Parameters:
pattern - The message pattern.
args - The arguments.
Returns:
The pattern with arguments inserted.

parseNumber

public static java.lang.Number parseNumber(java.lang.String value)
                                    throws java.text.ParseException
Parse the string value as a number.

Parameters:
value - The value.
Returns:
The number.
Throws:
java.text.ParseException - If parsing fails.

formatNumber

public static java.lang.String formatNumber(java.lang.Number number)
Format number as string.

Parameters:
number - The number.
Returns:
The string value or "" for null.

parseCurrency

public static java.lang.Number parseCurrency(java.lang.String value)
                                      throws java.text.ParseException
Parse the string value as a currency.

Parameters:
value - The value.
Returns:
The number.
Throws:
java.text.ParseException - If parsing fails.

formatCurrency

public static java.lang.String formatCurrency(java.lang.Number number)
Format currency as string.

Parameters:
number - The number.
Returns:
The string value or "" for null.

parseDate

public static java.util.Date parseDate(java.lang.String value)
                                throws java.text.ParseException
Parse the string value as a date.

Parameters:
value - The value.
Returns:
The date.
Throws:
java.text.ParseException - If parsing fails.

formatDate

public static java.lang.String formatDate(java.util.Date date)
Format date as string.

Parameters:
date - The date.
Returns:
The string value or "" for null.

parseTime

public static java.util.Date parseTime(java.lang.String value)
                                throws java.text.ParseException
Parse the string value as a time.

Parameters:
value - The value.
Returns:
The date.
Throws:
java.text.ParseException - If parsing fails.

formatTime

public static java.lang.String formatTime(java.util.Date date)
Format time as string.

Parameters:
date - The date.
Returns:
The string value or "" for null.

parseDateTime

public static java.util.Date parseDateTime(java.lang.String value)
                                    throws java.text.ParseException
Parse the string value as a date-time.

Parameters:
value - The value.
Returns:
The date.
Throws:
java.text.ParseException - If parsing fails.

formatDateTime

public static java.lang.String formatDateTime(java.util.Date date)
Format date-time as string.

Parameters:
date - The date.
Returns:
The string value or "" for null.

formatLongDate

public static java.lang.String formatLongDate(java.util.Date date)
Format date as string.

Parameters:
date - The date.
Returns:
The string value or "" for null.


Copyright © 2002-2004, Paul Strack. All Rights Reserved.