Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-246

[lang] CompositeFormat

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.2
    • None
    • None
    • Operating System: other
      Platform: Other

    • 30184

    Description

      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); }

        }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            trajano Archimedes Trajano
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment