You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/07/19 19:11:21 UTC

DO NOT REPLY [Bug 30184] New: - CompositeFormat

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30184>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30184

CompositeFormat

           Summary: CompositeFormat
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: trajano@yahoo.com


I wonder if this can be added.

/**
 * 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.
 * @author Archimedes Trajano
 */
public class CompositeFormat extends Format {
  private final Format parser;
  private final Format formatter;
  public CompositeFormat(final Format parser, final Format formatter) {
    this.parser = parser;
    this.formatter = formatter;
  }
  public StringBuffer format(final Object obj, final StringBuffer toAppendTo, 
final FieldPosition pos) {
    return formatter.format(obj,toAppendTo,pos);
  }
  public Object parseObject(final String source, final ParsePosition pos) {
    return parser.parseObject(source,pos);
  }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org