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

## org.apache.commons.lang.text
Class CompositeFormat

    java.lang.Object
      |
      +--java.text.Format
            |
            +--org.apache.commons.lang.text.CompositeFormat

All Implemented Interfaces:
  Cloneable, Serializable

public class CompositeFormat
extends Format

Formats using one formatter and parses using a different formatter. An example of use for this would be a webapp where data is taken in one way and stored in a database another way.

Version:
  $Id: $
Author:
  Archimedes Trajano
See Also:
  Serialized Form

Constructor Summary
`CompositeFormat(Format parser, Format formatter)` Create a format that points its parseObject method to one implementation and its format method to another.

Method Summary
`StringBuffer` | `format(Object obj, StringBuffer toAppendTo, FieldPosition pos)` Uses the formatter Format instance.
`Format` | `getFormatter()` Provides access to the parser Format implementation.
`Format` | `getParser()` Provides access to the parser Format implementation.
`Object` | `parseObject(String source, ParsePosition pos)` Uses the parser Format instance.
`String` | `reformat(String input)` Utility method to parse and then reformat a String.

Methods inherited from class java.text.Format
`clone, format, parseObject`

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

Constructor Detail

### CompositeFormat

    public CompositeFormat(Format parser,
                           Format formatter)

  Create a format that points its parseObject method to one implementation and its format method to another.
  Parameters:
    `parser` - implementation
    `formatter` - implementation

Method Detail

### format

    public StringBuffer format(Object obj,
                               StringBuffer toAppendTo,
                               FieldPosition pos)

  Uses the formatter Format instance.
  Overrides:
    `format` in class `Format`
  See Also:
    `Format.format(Object, StringBuffer, FieldPosition)`

### parseObject

    public Object parseObject(String source,
                              ParsePosition pos)

  Uses the parser Format instance.
  Overrides:
    `parseObject` in class `Format`
  See Also:
    `Format.parseObject(String, ParsePosition)`

### getParser

    public Format getParser()

  Provides access to the parser Format implementation.
  Returns:
    parser Format implementation

### getFormatter

    public Format getFormatter()

  Provides access to the parser Format implementation.
  Returns:
    formatter Format implementation

### reformat

    public String reformat(String input)
                    throws ParseException

  Utility method to parse and then reformat a String.
  Parameters:
    `input` - String to reformat
  Returns:
    A reformatted String
  Throws:
    `ParseException` - thrown by parseObject(String) call

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

Copyright © 2001-2005 - Apache Software Foundation