|
fop 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.util.text.AdvancedMessageFormat
public class AdvancedMessageFormat
Formats messages based on a template and with a set of named parameters. This is similar to
java.util.MessageFormat
but uses named parameters and supports conditional sub-groups.
Example:
Missing field "{fieldName}"[ at location: {location}]!
Nested Class Summary | |
---|---|
static interface |
AdvancedMessageFormat.Function
Implementations of this interface do some computation based on the message parameters given to it. |
static interface |
AdvancedMessageFormat.ObjectFormatter
Implementations of this interface format certain objects to strings. |
static interface |
AdvancedMessageFormat.Part
Represents a message template part. |
static interface |
AdvancedMessageFormat.PartFactory
Implementations of this interface parse a field part and return message parts. |
Constructor Summary | |
---|---|
AdvancedMessageFormat(java.lang.CharSequence pattern)
Construct a new message format. |
Method Summary | |
---|---|
java.lang.String |
format(java.util.Map params)
Formats a message with the given parameters. |
void |
format(java.util.Map params,
java.lang.StringBuffer target)
Formats a message with the given parameters. |
static void |
formatObject(java.lang.Object obj,
java.lang.StringBuffer target)
Formats an object to a string and writes the result to a string buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AdvancedMessageFormat(java.lang.CharSequence pattern)
pattern
- the message format pattern.Method Detail |
---|
public java.lang.String format(java.util.Map params)
params
- a Map of named parameters (Contents: public void format(java.util.Map params, java.lang.StringBuffer target)
params
- a Map of named parameters (Contents: target
- the target StringBuffer to write the formatted message topublic static void formatObject(java.lang.Object obj, java.lang.StringBuffer target)
toString()
method unless there is an
AdvancedMessageFormat.ObjectFormatter
that supports the object. AdvancedMessageFormat.ObjectFormatter
s are registered
through the service provider mechanism defined by the JAR specification.
obj
- the object to be formattedtarget
- the target string buffer
|
fop 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |