Package com.adobe.acs.commons.ccvar.util
Class ContentVariableReplacementUtil
java.lang.Object
com.adobe.acs.commons.ccvar.util.ContentVariableReplacementUtil
Util class used to provide helper methods for finding and replacing the tokens used in this feature.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdoReplacement(String input, String key, String replacement, TransformAction action) Utility method to replace values and optionally execute actions on the values to be replaced.Takes the current string and returns the placeholder value.static StringgetPlaceholder(String key) Takes the current key and returns it wrapped with the placeholder containersstatic ObjectReturns the value from the map based on the key.static booleanChecks if the passed map of variable replacements contains the key passed.
-
Method Details
-
getPlaceholder
Takes the current key and returns it wrapped with the placeholder containers- Parameters:
key- The full input key- Returns:
- The substring of the placeholder
-
hasKey
Checks if the passed map of variable replacements contains the key passed. It has an additional check for when the key contains an action.- Parameters:
contentVariableReplacements- Current map of content variable keys and valueskey- Current property key- Returns:
- Whether the map contains the key
-
getValue
Returns the value from the map based on the key. Handles the special case of when the key contains an action.- Parameters:
contentVariableReplacements- Current map of content variable keys and valueskey- Current property key- Returns:
- The value in the map
-
getKeys
Takes the current string and returns the placeholder value. Ex: ((value))- Parameters:
string- The full input string- Returns:
- A list of placeholders
-
doReplacement
public static String doReplacement(String input, String key, String replacement, TransformAction action) Utility method to replace values and optionally execute actions on the values to be replaced. The default output of this method will include base escaping of volatile HTML entities. Actions can define whether they explicitly disable this base escaping.- Parameters:
input- The input string containing the placeholderskey- The key containing the property name and an optional actionreplacement- The value to be replaced and optionally transformedaction- The action found in the placeholder key- Returns:
- The fully replaced value
-