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.cocoon.forms.datatype.convertor
Class Icu4jDateConvertor

    java.lang.Object
      org.apache.cocoon.forms.datatype.convertor.Icu4jDateConvertor

All Implemented Interfaces:
  Convertor

public class Icu4jDateConvertor
extends Object
implements Convertor

A Convertor for `Date` objects backed by ICU4J's `SimpleDateFormat` class.

It can be configured to use one of three variants: date, time or datetime and one of four styles: long, full, medium or short.

Alternatively, a formatting pattern can be used. This can either be a locale-dependent or locale-independent formatting pattern. When looking up a formatting pattern, a mechansim similar to resource bundle lookup is used. Suppose the locale is nl-BE, then first a formatting pattern for nl-BE will be sought, then one for nl, and if that is not found, finally the locale-independent formatting pattern will be used.

Date parsing can be configured to be lenient or not by specifying a `lenient` boolean attribute. By default, parsing is lenient.

Version:
  $Id: Icu4jDateConvertor.java 587759 2007-10-24 03:00:37Z vgritsenko $

Nested Class Summary

Nested classes inherited from class org.apache.cocoon.forms.datatype.convertor.Convertor
`Convertor.FormatCache`

Field Summary
`static String` | `DATE`
`static String` | `DATE_TIME`
`static String` | `TIME`

Constructor Summary
`Icu4jDateConvertor()`

Method Summary
`void` | `addFormattingPattern(Locale locale, String pattern)`
`ConversionResult` | `convertFromString(String value, Locale locale, Convertor.FormatCache formatCache)` Converts string representation into the object of convertor's type.
`String` | `convertToString(Object value, Locale locale, Convertor.FormatCache formatCache)`
`void` | `generateSaxFragment(ContentHandler contentHandler, Locale locale)` Generates a bit of information about this convertor (optional).
`protected com.ibm.icu.text.SimpleDateFormat` | `getDateFormat(Locale locale)`
`Class` | `getTypeClass()`
`void` | `setLenient(boolean lenient)`
`void` | `setNonLocalizedPattern(String pattern)`
`void` | `setStyle(int style)`
`void` | `setVariant(String variant)`

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

Field Detail

### DATE

    public static final String DATE

See Also:
  Constant Field Values

### TIME

    public static final String TIME

See Also:
  Constant Field Values

### DATE_TIME

    public static final String DATE_TIME

See Also:
  Constant Field Values

Constructor Detail

### Icu4jDateConvertor

    public Icu4jDateConvertor()

Method Detail

### convertFromString

    public ConversionResult convertFromString(String value,
                                              Locale locale,
                                              Convertor.FormatCache formatCache)

  Description copied from interface: `Convertor`
  Converts string representation into the object of convertor's type.

  Specified by:
    `convertFromString` in interface `Convertor`
  Parameters:
    `formatCache` - can be null if not needed

### convertToString

    public String convertToString(Object value,
                                  Locale locale,
                                  Convertor.FormatCache formatCache)

  Specified by:
    `convertToString` in interface `Convertor`

### getDateFormat

    protected com.ibm.icu.text.SimpleDateFormat getDateFormat(Locale locale)

### getTypeClass

    public Class getTypeClass()

  Specified by:
    `getTypeClass` in interface `Convertor`

### setStyle

    public void setStyle(int style)

  Parameters:
    `style` - one of the constants FULL, LONG, MEDIUM or SHORT defined in the `Date` class.

### setVariant

    public void setVariant(String variant)

### addFormattingPattern

    public void addFormattingPattern(Locale locale,
                                     String pattern)

### setNonLocalizedPattern

    public void setNonLocalizedPattern(String pattern)

### setLenient

    public void setLenient(boolean lenient)

### generateSaxFragment

    public void generateSaxFragment(ContentHandler contentHandler,
                                    Locale locale)
                             throws SAXException

  Description copied from interface: `Convertor`
  Generates a bit of information about this convertor (optional).

  Specified by:
    `generateSaxFragment` in interface `Convertor`
  Throws:
    `SAXException`

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 © 1999-2008 The Apache Software Foundation. All Rights Reserved.