public class CmsRemoveInnerNameFallback extends java.lang.Object implements CmsMultiMessages.I_KeyFallbackHandler, I_CmsRegexSubstitution
This handler, when given a key of the form label.foo.bar (starting with 'label' and containing at least three dot-separated components), removes the second component (in the example, this results in the key label.bar).
This can be useful if you want to reuse the same key for fields of multiple content types.
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
PATTERN
Regex pattern instance.
|
static java.lang.String |
REGEX_STR
Regex string.
|
Constructor and Description |
---|
CmsRemoveInnerNameFallback(java.lang.String config)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
com.google.common.base.Optional<java.lang.String> |
getFallbackKey(java.lang.String key)
Gets the fallback key for the given key, or the absent value if there is no fallback key.
|
java.lang.String |
substituteMatch(java.lang.String string,
java.util.regex.Matcher matcher)
Should return the substitution for the current match of the matcher.
|
public static final java.lang.String REGEX_STR
public static final java.util.regex.Pattern PATTERN
public CmsRemoveInnerNameFallback(java.lang.String config)
config
- the configuration (ignored)public com.google.common.base.Optional<java.lang.String> getFallbackKey(java.lang.String key)
CmsMultiMessages.I_KeyFallbackHandler
getFallbackKey
in interface CmsMultiMessages.I_KeyFallbackHandler
key
- the original keyCmsMultiMessages.I_KeyFallbackHandler.getFallbackKey(java.lang.String)
public java.lang.String substituteMatch(java.lang.String string, java.util.regex.Matcher matcher)
I_CmsRegexSubstitution
substituteMatch
in interface I_CmsRegexSubstitution
string
- the base string in which the match occurredmatcher
- the matcher which is currently being usedI_CmsRegexSubstitution.substituteMatch(java.lang.String, java.util.regex.Matcher)