public interface I_CmsMacroResolver
%(key)
or ${key}
in an input String.
Starting with OpenCms 7.0, the preferred form of a macro is %(key)
. This is to
avoid conflicts / confusion with the JSP EL, which also uses the ${key}
syntax.
The macro replacement is pre-implemented in
.CmsMacroResolver.resolveMacros(String, I_CmsMacroResolver)
限定符和类型 | 字段和说明 |
---|---|
static char |
MACRO_DELIMITER
Delimiter char
'%' for a macro - new / current style. |
static char |
MACRO_DELIMITER_OLD
Delimiter char
'$' for a macro - old style. |
static char |
MACRO_END
End char
')' for a macro - new / current style. |
static char |
MACRO_END_OLD
End char
'}' for a macro - old style. |
static char |
MACRO_START
Start char
'(' for a macro - new / current style. |
static char |
MACRO_START_OLD
Start char
'{' for a macro - old style. |
限定符和类型 | 方法和说明 |
---|---|
java.lang.String |
getMacroValue(java.lang.String macro)
Resolves a single macro to the macro value, returns
null if the macro could not be resolved. |
boolean |
isKeepEmptyMacros()
Returns
true if macros that could not be resolved are kept "as is" in the
input String, false if they are replaced by an empty String. |
java.lang.String |
resolveMacros(java.lang.String input)
Resolves all macros in the input, replacing them with the macro values.
|
static final char MACRO_DELIMITER
'%'
for a macro - new / current style.static final char MACRO_DELIMITER_OLD
'$'
for a macro - old style.static final char MACRO_END
')'
for a macro - new / current style.static final char MACRO_END_OLD
'}'
for a macro - old style.static final char MACRO_START
'('
for a macro - new / current style.static final char MACRO_START_OLD
'{'
for a macro - old style.java.lang.String getMacroValue(java.lang.String macro)
null
if the macro could not be resolved.macro
- the macro to resolvenull
if the macro could not be resolvedboolean isKeepEmptyMacros()
true
if macros that could not be resolved are kept "as is" in the
input String, false
if they are replaced by an empty String.true
if macros that could not be resolved are kept "as is" in the
input String, false
if they are replaced by an empty Stringjava.lang.String resolveMacros(java.lang.String input)
The flag isKeepEmptyMacros()
controls how to deal with
macros found in the input that can not be resolved.
input
- the input to resolve the macros in