Package org.opencms.util
Interface I_CmsMacroResolver
- All Known Implementing Classes:
CmsGalleryNameMacroResolver
,CmsJspLinkMacroResolver
,CmsJspTagContentInfo
,CmsKeyDummyMacroResolver
,CmsMacroResolver
,CmsNotificationMacroResolver
,CmsToolMacroResolver
,CmsVersionMacroResolver
public interface I_CmsMacroResolver
Describes a macro mapper, which is used to efficiently resolve macros
in the form of
%(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)
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
Delimiter char'%'
for a macro - new / current style.static final char
Delimiter char'$'
for a macro - old style.static final char
End char')'
for a macro - new / current style.static final char
End char'}'
for a macro - old style.static final char
Start char'('
for a macro - new / current style.static final char
Start char'{'
for a macro - old style. -
Method Summary
Modifier and TypeMethodDescriptiongetMacroValue
(String macro) Resolves a single macro to the macro value, returnsnull
if the macro could not be resolved.boolean
Returnstrue
if macros that could not be resolved are kept "as is" in the input String,false
if they are replaced by an empty String.resolveMacros
(String input) Resolves all macros in the input, replacing them with the macro values.
-
Field Details
-
MACRO_DELIMITER
Delimiter char'%'
for a macro - new / current style.- See Also:
-
MACRO_DELIMITER_OLD
Delimiter char'$'
for a macro - old style.- See Also:
-
MACRO_END
End char')'
for a macro - new / current style.- See Also:
-
MACRO_END_OLD
End char'}'
for a macro - old style.- See Also:
-
MACRO_START
Start char'('
for a macro - new / current style.- See Also:
-
MACRO_START_OLD
Start char'{'
for a macro - old style.- See Also:
-
-
Method Details
-
getMacroValue
Resolves a single macro to the macro value, returnsnull
if the macro could not be resolved.- Parameters:
macro
- the macro to resolve- Returns:
- the resolved macro or
null
if the macro could not be resolved
-
isKeepEmptyMacros
boolean isKeepEmptyMacros()Returnstrue
if macros that could not be resolved are kept "as is" in the input String,false
if they are replaced by an empty String.- 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
-
resolveMacros
Resolves all macros in the input, replacing them with the macro values.The flag
isKeepEmptyMacros()
controls how to deal with macros found in the input that can not be resolved.- Parameters:
input
- the input to resolve the macros in- Returns:
- the input with all macros resolved
-