GeezerVison is showing docs.oracle.com — MessageFormat (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.text
Class MessageFormat
-
-
Nested Class Summary
Nested Classes
| Modifier and Type |
Class |
Description |
static class |
MessageFormat.Field |
Defines constants that are used as attribute keys in the
AttributedCharacterIterator returned
from MessageFormat.formatToCharacterIterator.
|
-
Constructor Summary
Constructors
| Constructor |
Description |
MessageFormat(String pattern) |
Constructs a MessageFormat for the default
FORMAT locale and the
specified pattern.
|
MessageFormat(String pattern,
Locale locale) |
Constructs a MessageFormat for the specified locale and
pattern.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
void |
applyPattern(String pattern) |
Sets the pattern used by this message format.
|
Object |
clone() |
Creates and returns a copy of this object.
|
boolean |
equals(Object obj) |
Equality comparison between two message format objects
|
StringBuffer |
format(Object[] arguments,
StringBuffer result,
FieldPosition pos) |
Formats an array of objects and appends the MessageFormat's
pattern, with format elements replaced by the formatted objects, to the
provided StringBuffer.
|
StringBuffer |
format(Object arguments,
StringBuffer result,
FieldPosition pos) |
Formats an array of objects and appends the MessageFormat's
pattern, with format elements replaced by the formatted objects, to the
provided StringBuffer.
|
static String |
format(String pattern,
Object... arguments) |
Creates a MessageFormat with the given pattern and uses it
to format the given arguments.
|
AttributedCharacterIterator |
formatToCharacterIterator(Object arguments) |
Formats an array of objects and inserts them into the
MessageFormat's pattern, producing an
AttributedCharacterIterator.
|
Format[] |
getFormats() |
Gets the formats used for the format elements in the
previously set pattern string.
|
Format[] |
getFormatsByArgumentIndex() |
Gets the formats used for the values passed into
format methods or returned from parse
methods.
|
Locale |
getLocale() |
Gets the locale that's used when creating or comparing subformats.
|
int |
hashCode() |
Generates a hash code for the message format object.
|
Object[] |
parse(String source) |
Parses text from the beginning of the given string to produce an object
array.
|
Object[] |
parse(String source,
ParsePosition pos) |
Parses the string.
|
Object |
parseObject(String source,
ParsePosition pos) |
Parses text from a string to produce an object array.
|
void |
setFormat(int formatElementIndex,
Format newFormat) |
Sets the format to use for the format element with the given
format element index within the previously set pattern string.
|
void |
setFormatByArgumentIndex(int argumentIndex,
Format newFormat) |
Sets the format to use for the format elements within the
previously set pattern string that use the given argument
index.
|
void |
setFormats(Format[] newFormats) |
Sets the formats to use for the format elements in the
previously set pattern string.
|
void |
setFormatsByArgumentIndex(Format[] newFormats) |
Sets the formats to use for the values passed into
format methods or returned from parse
methods.
|
void |
setLocale(Locale locale) |
Sets the locale to be used when creating or comparing subformats.
|
String |
toPattern() |
Returns a pattern representing the current state of the message format.
|
-
-
Method Detail
-
toPattern
public String toPattern()
Returns a pattern representing the current state of the message format.
The string is constructed from internal information and therefore
does not necessarily equal the previously applied pattern.
- Returns:
- a pattern representing the current state of the message format
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|