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

## com.tonbeller.wcf.format
Class Formatter

    java.lang.Object
      com.tonbeller.wcf.format.Formatter

All Implemented Interfaces:
  BasicTypes

public class Formatter
extends java.lang.Object
implements BasicTypes

parse/print java objects for user input/display.

Field Summary

Fields inherited from interface com.tonbeller.wcf.format.BasicTypes
`BOOLEAN_TYPE, DATE_TYPE, DOUBLE_TYPE, EMAIL_TYPE, INT_TYPE, POSINT_TYPE, REQSTR_TYPE, STRING_TYPE`

Constructor Summary
`Formatter()` Constructor Formatter.

Method Summary
`void` | `addHandler(FormatHandler newHandler)` adds a new handler for a specific data type.
`java.lang.String` | `format(java.lang.String type, java.lang.Object value, java.lang.String userPattern)` prints value
`FormatHandler` | `getHandler(java.lang.String type)` searches for the Format Handler that is registered for the given type
`java.util.Locale` | `getLocale()`
`FormatHandler` | `guessHandler(java.lang.Object value)` returns the the first renderer that can handle the object
`java.lang.Object` | `parse(java.lang.String type, java.lang.String value, java.lang.String userPattern)` parses value into an Object
`void` | `setLocale(java.util.Locale locale)`

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

Constructor Detail

### Formatter

    public Formatter()

  Constructor Formatter.

Method Detail

### setLocale

    public void setLocale(java.util.Locale locale)

### getLocale

    public java.util.Locale getLocale()

### addHandler

    public void addHandler(FormatHandler newHandler)

  adds a new handler for a specific data type.

### getHandler

    public FormatHandler getHandler(java.lang.String type)

  searches for the Format Handler that is registered for the given type

  Parameters:
    `type` - the requested type. if null or empty string, "string" is assumed
  Returns:
    the handler for type or null if there is no handler

### format

    public java.lang.String format(java.lang.String type,
                                   java.lang.Object value,
                                   java.lang.String userPattern)

  prints value

### parse

    public java.lang.Object parse(java.lang.String type,
                                  java.lang.String value,
                                  java.lang.String userPattern)

  parses value into an Object

### guessHandler

    public FormatHandler guessHandler(java.lang.Object value)

  returns the the first renderer that can handle the object

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