Class CompositeFormat

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    @Deprecated
    public class CompositeFormat
    extends java.text.Format
    Deprecated.
    As of 3.6, use Apache Commons Text CompositeFormat.
    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.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.text.Format

        java.text.Format.Field
    • Constructor Summary

      Constructors 
      Constructor Description
      CompositeFormat​(java.text.Format parser, java.text.Format formatter)
      Deprecated.
      Create a format that points its parseObject method to one implementation and its format method to another.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.StringBuffer format​(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
      Deprecated.
      Uses the formatter Format instance.
      java.text.Format getFormatter()
      Deprecated.
      Gets the formatter Format implementation.
      java.text.Format getParser()
      Deprecated.
      Gets the parser Format implementation.
      java.lang.Object parseObject​(java.lang.String source, java.text.ParsePosition pos)
      Deprecated.
      Uses the parser Format instance.
      java.lang.String reformat​(java.lang.String input)
      Deprecated.
      Utility method to parse and then reformat a String.
      • Methods inherited from class java.text.Format

        clone, format, formatToCharacterIterator, parseObject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeFormat

        public CompositeFormat​(java.text.Format parser,
                               java.text.Format formatter)
        Deprecated.
        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 java.lang.StringBuffer format​(java.lang.Object obj,
                                             java.lang.StringBuffer toAppendTo,
                                             java.text.FieldPosition pos)
        Deprecated.
        Uses the formatter Format instance.
        Specified by:
        format in class java.text.Format
        Parameters:
        obj - The object to format
        toAppendTo - The StringBuffer to append to
        pos - The FieldPosition to use (or ignore).
        Returns:
        toAppendTo
        See Also:
        Format.format(Object, StringBuffer, FieldPosition)
      • getFormatter

        public java.text.Format getFormatter()
        Deprecated.
        Gets the formatter Format implementation.
        Returns:
        The formatter Format implementation.
      • getParser

        public java.text.Format getParser()
        Deprecated.
        Gets the parser Format implementation.
        Returns:
        parser Format implementation
      • parseObject

        public java.lang.Object parseObject​(java.lang.String source,
                                            java.text.ParsePosition pos)
        Deprecated.
        Uses the parser Format instance.
        Specified by:
        parseObject in class java.text.Format
        Parameters:
        source - The String source
        pos - The ParsePosition containing the position to parse from, will be updated according to parsing success (index) or failure (error index)
        Returns:
        The parsed Object
        See Also:
        Format.parseObject(String, ParsePosition)
      • reformat

        public java.lang.String reformat​(java.lang.String input)
                                  throws java.text.ParseException
        Deprecated.
        Utility method to parse and then reformat a String.
        Parameters:
        input - String to reformat
        Returns:
        A reformatted String
        Throws:
        java.text.ParseException - Thrown by parseObject(String) call.