Class MessageFormat


  • public class MessageFormat
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MessageFormat.Field2  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void applyPattern​(java.lang.String pttrn)
      Sets the pattern used by this message format.
      void applyPattern​(java.lang.String pattern, MessagePattern.ApostropheMode aposMode)
      Sets the ApostropheMode and the pattern used by this message format.
      java.lang.StringBuilder format​(java.lang.Object[] arguments, java.lang.StringBuilder result, java.text.FieldPosition pos)  
      java.lang.StringBuilder format​(java.util.Map<java.lang.String,​java.lang.Object> arguments, java.lang.StringBuilder result, java.text.FieldPosition pos)  
      • Methods inherited from class java.lang.Object

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

      • MessageFormat

        public MessageFormat()
      • MessageFormat

        public MessageFormat​(java.lang.String pattern)
      • MessageFormat

        public MessageFormat​(java.lang.String pattern,
                             java.util.Locale locale)
    • Method Detail

      • applyPattern

        public void applyPattern​(java.lang.String pttrn)
        Sets the pattern used by this message format. Parses the pattern and caches Format objects for simple argument types. Patterns and their interpretation are specified in the class description.
        Parameters:
        pttrn - the pattern for this message format
        Throws:
        java.lang.IllegalArgumentException - if the pattern is invalid
      • applyPattern

        public void applyPattern​(java.lang.String pattern,
                                 MessagePattern.ApostropheMode aposMode)
        Sets the ApostropheMode and the pattern used by this message format. Parses the pattern and caches Format objects for simple argument types. Patterns and their interpretation are specified in the class description.

        This method is best used only once on a given object to avoid confusion about the mode, and after constructing the object with an empty pattern string to minimize overhead.

        Parameters:
        pattern - the pattern for this message format
        aposMode - the new ApostropheMode
        Throws:
        java.lang.IllegalArgumentException - if the pattern is invalid
        See Also:
        MessagePattern.ApostropheMode
      • format

        public final java.lang.StringBuilder format​(java.lang.Object[] arguments,
                                                    java.lang.StringBuilder result,
                                                    java.text.FieldPosition pos)
      • format

        public final java.lang.StringBuilder format​(java.util.Map<java.lang.String,​java.lang.Object> arguments,
                                                    java.lang.StringBuilder result,
                                                    java.text.FieldPosition pos)