Package org.mycore.common
Class MCRPropertiesResolver
java.lang.Object
org.mycore.common.MCRTextResolver
org.mycore.common.MCRPropertiesResolver
The
MCRPropertiesResolver
supports substitution of any %reference%
in a String
or Property
instance.
// possible use case
Properties p = MCRConfiguration.instance().getProperties();
MCRPropertiesResolver r = new MCRPropertiesResolver(p);
Properties resolvedProperties = r.resolveAll(p);
- Author:
- Matthias Eichner
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mycore.common.MCRTextResolver
MCRTextResolver.CircularDependencyExecption, MCRTextResolver.CircularDependencyTracker, MCRTextResolver.Condition, MCRTextResolver.EscapeCharacter, MCRTextResolver.ResolveDepth, MCRTextResolver.Term, MCRTextResolver.TermContainer, MCRTextResolver.Text, MCRTextResolver.Variable
-
Field Summary
Fields inherited from class org.mycore.common.MCRTextResolver
resolveDepth, retainText, termContainer, tracker, variablesMap
-
Constructor Summary
ConstructorDescriptionMCRPropertiesResolver
(Map<String, String> propertiesMap) MCRPropertiesResolver
(Properties properties) -
Method Summary
Modifier and TypeMethodDescriptionaddVariable
(String name, String value) Adds a new variable to the resolver.protected void
Creates the term list for the text resolver and adds the default terms.resolveAll
(Map<String, String> toResolve) Substitute all %references% of the givenMap
and return a newMap
object.resolveAll
(Properties toResolve) Substitute all %references% of the givenProperties
and return a newProperties
object.Methods inherited from class org.mycore.common.MCRTextResolver
containsVariable, getResolveDepth, getTermContainer, getTracker, getValue, getVariables, isRetainText, mixin, mixin, registerTerm, removeVariable, resolve, setResolveDepth, setRetainText, unregisterTerm
-
Constructor Details
-
MCRPropertiesResolver
public MCRPropertiesResolver() -
MCRPropertiesResolver
-
MCRPropertiesResolver
-
-
Method Details
-
addVariable
Description copied from class:MCRTextResolver
Adds a new variable to the resolver. This overwrites a existing variable with the same name.- Overrides:
addVariable
in classMCRTextResolver
- Parameters:
name
- name of the variablevalue
- value of the variable- Returns:
- the previous value of the specified name, or null if it did not have one
-
registerDefaultTerms
protected void registerDefaultTerms() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationExceptionDescription copied from class:MCRTextResolver
Creates the term list for the text resolver and adds the default terms.- Overrides:
registerDefaultTerms
in classMCRTextResolver
- Throws:
NoSuchMethodException
InvocationTargetException
IllegalAccessException
InstantiationException
-
resolveAll
Substitute all %references% of the givenProperties
and return a newProperties
object.- Parameters:
toResolve
- properties to resolve- Returns:
- resolved properties
-
resolveAll
Substitute all %references% of the givenMap
and return a newMap
object.- Parameters:
toResolve
- properties to resolve- Returns:
- resolved properties
-