public abstract class AbstractMessage extends Object implements Message
Message
.Message.AlternateFormMapping
Constructor and Description |
---|
AbstractMessage(GwtLocaleFactory localeFactory,
MessageInterface msgIntf) |
Modifier and Type | Method and Description |
---|---|
void |
accept(MessageVisitor mv)
Accept a
MessageVisitor . |
void |
accept(MessageVisitor mv,
GwtLocale locale)
Accept a
MessageVisitor , using translations from the requested
locale. |
protected void |
addMapping(List<Message.AlternateFormMapping> mapping,
int numSelectors,
String joinedForms,
String msg) |
int |
compareTo(Message o)
Messages are ordered by their keys.
|
protected List<AlternateMessageSelector.AlternateForm> |
defaultForms() |
Iterable<Message.AlternateFormMapping> |
getAllMessageForms()
Get the list of all possible messages.
|
protected String[] |
getAlternateMessages()
Get the alternate message forms from either an AlternateMessages annotation
or a PluralText annotation.
|
abstract <A extends Annotation> |
getAnnotation(Class<A> annotClass)
Return the requested annotation present on this message, including parents
if the annotation is inherited.
|
protected GwtLocale |
getDefaultLocale() |
String |
getDefaultMessage()
Return the default form of this message.
|
String |
getDescription()
Return the description of this message.
|
String |
getKey()
Return the key associated with this message.
|
protected GwtLocaleFactory |
getLocaleFactory() |
GwtLocale |
getMatchedLocale()
Get the locale for this translation.
|
String |
getMeaning()
Return the meaning of this message.
|
MessageInterface |
getMessageInterface()
Return the
MessageInterface this message is associated with. |
MessageFormatUtils.MessageStyle |
getMessageStyle()
Return the message style (ie, quoting and argument rules) of this message.
|
abstract String |
getMethodName()
Return the name of the method for this message - this should generally only
be used in providing error messages.
|
abstract List<Parameter> |
getParameters()
Get the parameters defined for this message.
|
abstract Type |
getReturnType()
Return the declared return type for this message.
|
int[] |
getSelectorParameterIndices()
Get the list of parameters controlling alternate message selection.
|
abstract MessageTranslation |
getTranslation(GwtLocale locale)
Get an appropriate translation for this message for a given locale.
|
protected void |
init()
Called by subclasses to complete initialization, after ensuring that calls
to
getAnnotation(Class) will function properly. |
abstract boolean |
isAnnotationPresent(Class<? extends Annotation> annotClass)
Check if a specified annotation is present on this message (including
via inheritance if the annotation is inherited).
|
protected boolean |
isStringMap() |
public AbstractMessage(GwtLocaleFactory localeFactory, MessageInterface msgIntf)
public void accept(MessageVisitor mv) throws MessageProcessingException
Message
MessageVisitor
.accept
in interface Message
mv
- MessageVisitor
to callMessageProcessingException
- if thrown by the visitor or its
sub-visitorspublic void accept(MessageVisitor mv, GwtLocale locale) throws MessageProcessingException
Message
MessageVisitor
, using translations from the requested
locale.accept
in interface Message
mv
- MessageVisitor
to calllocale
- locale to use for translations, or null to use the messages
present in the sourceMessageProcessingException
- if thrown by the visitor or its
sub-visitorspublic int compareTo(Message o)
Message
compareTo
in interface Message
compareTo
in interface Comparable<Message>
o
, 0 if they are equal, or
1 if this is message is after {code o}public Iterable<Message.AlternateFormMapping> getAllMessageForms()
Message
getAllMessageForms
in interface Message
getAllMessageForms
in interface MessageTranslation
public abstract <A extends Annotation> A getAnnotation(Class<A> annotClass)
Message
getAnnotation
in interface Message
public String getDefaultMessage()
Message
getDefaultMessage
in interface Message
getDefaultMessage
in interface MessageTranslation
public String getDescription()
Message
getDescription
in interface Message
public String getKey()
Message
public GwtLocale getMatchedLocale()
MessageTranslation
getMatchedLocale
in interface MessageTranslation
public String getMeaning()
Message
getMeaning
in interface Message
public MessageInterface getMessageInterface()
Message
MessageInterface
this message is associated with.getMessageInterface
in interface Message
MessageInterface
instancepublic MessageFormatUtils.MessageStyle getMessageStyle()
Message
getMessageStyle
in interface Message
public abstract String getMethodName()
Message
getMethodName
in interface Message
public abstract List<Parameter> getParameters()
Message
getParameters
in interface Message
public abstract Type getReturnType()
Message
getReturnType
in interface Message
public int[] getSelectorParameterIndices()
Message
getSelectorParameterIndices
in interface Message
Message.getParameters()
public abstract MessageTranslation getTranslation(GwtLocale locale)
Message
getTranslation
in interface Message
locale
- a locale to get a translation for, or null to retrieve the
message in the sourceMessageTranslation
instance - if locale is null,
or no better match is found, this
must be returnedpublic abstract boolean isAnnotationPresent(Class<? extends Annotation> annotClass)
Message
isAnnotationPresent
in interface Message
protected void addMapping(List<Message.AlternateFormMapping> mapping, int numSelectors, String joinedForms, String msg)
protected List<AlternateMessageSelector.AlternateForm> defaultForms()
protected String[] getAlternateMessages()
protected GwtLocale getDefaultLocale()
protected GwtLocaleFactory getLocaleFactory()
protected void init()
getAnnotation(Class)
will function properly.protected boolean isStringMap()
Copyright © 2018. All rights reserved.