|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.elca.el4j.services.i18n.RewritingUtilities
public class RewritingUtilities
A rewriting rule providing a set of utility functions. The keys accepted by this rule are of the form
namespace function . argument
Nested Class Summary | |
---|---|
protected static class |
RewritingUtilities.Function
A utility function. |
Field Summary | |
---|---|
protected Map<String,RewritingUtilities.Function> |
m_functions
the functions provided by this instance, keyed by function.m_name. |
protected String |
m_requiredPrefix
The package-like prefix to function names. |
Constructor Summary | |
---|---|
RewritingUtilities()
Creates a utility function package called Utils and
adds default utility functions. |
|
RewritingUtilities(String packageName)
Constructor. |
Method Summary | |
---|---|
void |
add(RewritingUtilities.Function f)
Adds a function, replacing any previous function with the same name. |
void |
remove(String functionName)
removes a function. |
StringBuffer |
rewrite(String key,
Object[] arguments,
StringBuffer target)
Attempts to rewrite the key with this rule and the provided user arguments. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String m_requiredPrefix
protected Map<String,RewritingUtilities.Function> m_functions
Constructor Detail |
---|
public RewritingUtilities()
Utils
and
adds default utility functions.
public RewritingUtilities(String packageName)
packageName
- the package name as used to form keys.Method Detail |
---|
public void add(RewritingUtilities.Function f)
public void remove(String functionName)
functionName
- the name of the function to be removedpublic StringBuffer rewrite(String key, Object[] arguments, StringBuffer target)
target
, which is then returned. If unsuccessful, this method
does not incur observable side effects and returns null
.
rewrite
in interface MessageRewriter.Rule
key
- the key to rewritearguments
- the user arguments (used to replace {0}, {1}, ...)target
- the StringBuffer to append to
target
if successful, null
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |