|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opends.messages.Message
@PublicAPI(stability=UNCOMMITTED,
mayInstantiate=true,
mayExtend=false,
mayInvoke=true)
public final class Message
Renders sensitive textural strings. In most cases message are intended
to render textural strings in a locale-sensitive manner although this
class defines convenience methods for creating uninternationalized
Message objects that render the same text regardless of
the requested locale.
This class implements CharSequence so that messages can
be supplied as arguments to other messages. This way messages can
be composed of fragments of other messages if necessary.
MessageDescriptor| Field Summary | |
|---|---|
static Message |
EMPTY
Represents an empty message string. |
| Method Summary | |
|---|---|
char |
charAt(int index)
Returns the char value at the specified index of
this message rendered using the default locale. |
char |
charAt(java.util.Locale locale,
int index)
Returns the char value at the specified index of
this message rendered using a specific. |
int |
compareTo(Message o)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object o)
Indicates whether some other message is "equal to" this one. |
void |
formatTo(java.util.Formatter formatter,
int flags,
int width,
int precision)
Formats the object using the provided formatter. |
static Message |
fromObject(java.lang.Object object,
java.lang.Object... arguments)
Creates an uninternationalized message from the string representation of an object. |
byte[] |
getBytes()
Returns the byte representation of this messages in the default locale. |
MessageDescriptor |
getDescriptor()
Gets the descriptor that holds descriptive information about this message. |
int |
hashCode()
Returns a hash code value for the object. |
int |
length()
Returns the length of this message as rendered using the default locale. |
int |
length(java.util.Locale locale)
Returns the length of this message as rendered using a specific locale. |
static Message |
raw(Category category,
Severity severity,
java.lang.CharSequence formatString,
java.lang.Object... args)
Creates an uninternationalized message that will render itself the same way regardless of the locale requested in toString(Locale). |
static Message |
raw(java.lang.CharSequence formatString,
java.lang.Object... args)
Creates an uninternationalized message that will render itself the same way regardless of the locale requested in toString(Locale). |
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a new CharSequence that is a subsequence
of this message rendered using the default locale. |
java.lang.CharSequence |
subSequence(java.util.Locale locale,
int start,
int end)
Returns a new CharSequence that is a subsequence
of this message rendered using a specific locale. |
java.lang.String |
toString()
Gets the string representation of this message. |
java.lang.String |
toString(java.util.Locale locale)
Gets the string representation of this message appropriate for locale. |
static java.lang.String |
toString(Message message)
Returns the string representation of the message in the default locale. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Message EMPTY
| Method Detail |
|---|
public static Message raw(java.lang.CharSequence formatString,
java.lang.Object... args)
toString(Locale). The message will have a
category of Categore.USER_DEFINED and a severity
of Severity.INFORMATION
Note that the types for args must be consistent with any
argument specifiers appearing in formatString according
to the rules of java.util.Formatter. A mismatch in type information
will cause this message to render without argument substitution.
Before using this method you should be sure that the message you
are creating is locale sensitive. If so you should instead create
a formal message.
formatString - of the message or the message itself if not
arguments are necessaryargs - any arguments for the format string
formatString is null
public static Message raw(Category category,
Severity severity,
java.lang.CharSequence formatString,
java.lang.Object... args)
toString(Locale).
Note that the types for args must be consistent with any
argument specifiers appearing in formatString according
to the rules of java.util.Formatter. A mismatch in type information
will cause this message to render without argument substitution.
Before using this method you should be sure that the message you
are creating is locale sensitive. If so you should instead create
a formal message.
category - of this messageseverity - of this messageformatString - of the message or the message itself if not
arguments are necessaryargs - any arguments for the format string
formatString is null
public static Message fromObject(java.lang.Object object,
java.lang.Object... arguments)
args must be consistent with any
argument specifiers appearing in formatString according
to the rules of java.util.Formatter. A mismatch in type information
will cause this message to render without argument substitution.
object - from which the message will be createdarguments - for message
object is nullpublic static java.lang.String toString(Message message)
message - to stringify
message of null if
message is nullpublic java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectpublic java.lang.String toString(java.util.Locale locale)
locale.
locale - for which the string representation
will be returned
public MessageDescriptor getDescriptor()
public int length()
length in interface java.lang.CharSequencechars in this messagepublic byte[] getBytes()
public char charAt(int index)
throws java.lang.IndexOutOfBoundsException
char value at the specified index of
this message rendered using the default locale.
charAt in interface java.lang.CharSequenceindex - the index of the char value to be returned
char value
java.lang.IndexOutOfBoundsException - if the index argument is negative or not less than
length()
public java.lang.CharSequence subSequence(int start,
int end)
throws java.lang.IndexOutOfBoundsException
CharSequence that is a subsequence
of this message rendered using the default locale.
The subsequence starts with the char
value at the specified index and ends with the char
value at index end - 1. The length (in chars)
of the returned sequence is end - start, so if
start == end then an empty sequence is returned.
subSequence in interface java.lang.CharSequencestart - the start index, inclusiveend - the end index, exclusive
java.lang.IndexOutOfBoundsException - if start or end are negative,
if end is greater than length(),
or if start is greater than endpublic int length(java.util.Locale locale)
locale - for which the rendering of this message will be
used in determining the length
chars in this message
public char charAt(java.util.Locale locale,
int index)
throws java.lang.IndexOutOfBoundsException
char value at the specified index of
this message rendered using a specific.
locale - for which the rendering of this message will be
used in determining the characterindex - the index of the char value to be returned
char value
java.lang.IndexOutOfBoundsException - if the index argument is negative or not less than
length()
public java.lang.CharSequence subSequence(java.util.Locale locale,
int start,
int end)
throws java.lang.IndexOutOfBoundsException
CharSequence that is a subsequence
of this message rendered using a specific locale.
The subsequence starts with the char
value at the specified index and ends with the char
value at index end - 1. The length (in chars)
of the returned sequence is end - start, so if
start == end then an empty sequence is returned.
locale - for which the rendering of this message will be
used in determining the characterstart - the start index, inclusiveend - the end index, exclusive
java.lang.IndexOutOfBoundsException - if start or end are negative,
if end is greater than length(),
or if start is greater than end
public void formatTo(java.util.Formatter formatter,
int flags,
int width,
int precision)
throws java.util.IllegalFormatException
formatter.
formatTo in interface java.util.Formattableformatter - The formatter.flags - The flags modify the output format. The value is interpreted as
a bitmask. Any combination of the following flags may be set:
FormattableFlags.LEFT_JUSTIFY, FormattableFlags.UPPERCASE, and FormattableFlags.ALTERNATE. If no flags are set, the
default formatting of the implementing class will apply.width - The minimum number of characters to be written to the output.
If the length of the converted value is less than the
width then the output will be padded by
' ' until the total number of characters
equals width. The padding is at the beginning by default. If
the FormattableFlags.LEFT_JUSTIFY flag is set
then the padding will be at the end. If width is
-1 then there is no minimum.precision - The maximum number of characters to be written to the output.
The precision is applied before the width, thus the output will
be truncated to precision characters even if the
width is greater than the precision. If
precision is -1 then there is no explicit
limit on the number of characters.
java.util.IllegalFormatException - If any of the parameters are invalid. For specification of all
possible formatting errors, see the Details section of the
formatter class specification.public int compareTo(Message o)
compareTo in interface java.lang.Comparable<Message>o - the object to be compared.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the reference object with which to compare.
true if this object is the same as the obj
argument; false otherwise.hashCode(),
Hashtablepublic int hashCode()
hashCode in class java.lang.ObjectObject.equals(java.lang.Object),
Hashtable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||