Interface IWorkflowPlaceholderHandler
- 
public interface IWorkflowPlaceholderHandlerInterface for the workflow placeholder handler that lets you replace placeholders in strings easily. Usually you only want to usereplaceStringFieldsor possibly alsoreplaceAll-- the other methods are provided for advanced usage.- Since:
 - 7.0.0
 - Author:
 - XIMA MEDIA GmbH
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DefaultReplacerParameterscreateReplacerParams(IContextReplacerParams contextParams)Creates aDefaultReplacerParameterswith the given replacer context.StringreplaceAll(String text, IPlaceholderEscaper syntax)Replaces all placeholders in the given string, regardless of their type.StringreplaceAll(String text, IPlaceholderEscaper syntax, IContextReplacerParams contextParams)Replaces all placeholders in the given string, regardless of their type.StringreplaceContext(String text, IPlaceholderEscaper syntax, IContextReplacerParams contextParams)Replaces all context placeholders in the given string.StringreplaceForm(String text, IPlaceholderEscaper syntax)Replaces all form placeholders in the given string.StringreplaceI18n(String text, IPlaceholderEscaper syntax)Replaces all i18n placeholders in the given string.StringreplaceSession(String text, IPlaceholderEscaper syntax)Replaces all session placeholders in the given string.voidreplaceStringFields(Object model)Replaces all placeholders in the fields of given model, provided they are annotated withPlaceholder.voidreplaceStringFields(Object model, IContextReplacerParams contextParams)Replaces all placeholders in the fields of given model, provided they are annotated withPlaceholder.StringreplaceSystem(String text, IPlaceholderEscaper syntax)Replaces all system placeholders in the given string.StringreplaceTemplate(String text, IPlaceholderEscaper syntax)Replaces all template placeholders in the given string. 
 - 
 
- 
- 
Method Detail
- 
replaceAll
String replaceAll(String text, IPlaceholderEscaper syntax)
Replaces all placeholders in the given string, regardless of their type.- Parameters:
 text- Text that may contain placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all placeholders replaced.
 
 
- 
replaceAll
String replaceAll(String text, IPlaceholderEscaper syntax, IContextReplacerParams contextParams)
Replaces all placeholders in the given string, regardless of their type.- Parameters:
 text- Text that may contain placeholders.contextParams- A map with context values to use for the replacement of context placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all placeholders replaced.
 
 
- 
replaceContext
String replaceContext(String text, IPlaceholderEscaper syntax, IContextReplacerParams contextParams)
Replaces all context placeholders in the given string.- Parameters:
 text- Text that may contain context placeholders.contextParams- A map with context values to use for the replacement.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all context placeholders replaced.
 
 
- 
replaceForm
String replaceForm(String text, IPlaceholderEscaper syntax)
Replaces all form placeholders in the given string.- Parameters:
 text- Text that may contain form placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all form placeholders replaced.
 
 
- 
replaceI18n
String replaceI18n(String text, IPlaceholderEscaper syntax)
Replaces all i18n placeholders in the given string.- Parameters:
 text- Text that may contain i18n placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all i18n placeholders replaced.
 
 
- 
replaceSession
String replaceSession(String text, IPlaceholderEscaper syntax)
Replaces all session placeholders in the given string.- Parameters:
 text- Text that may contain session placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all session placeholders replaced.
 
 
- 
replaceStringFields
void replaceStringFields(Object model) throws RuntimeException
Replaces all placeholders in the fields of given model, provided they are annotated withPlaceholder.Specifically, this method iterates over all non-static, non-final, non-transient instance fields of the runtime class of the given model, including all its super classes. Access control is ignored, i.e. all public, protected, package-private, and private fields are considered. Then:
- For each field whose declared type is exactly 
Stringand or which aPlaceholderannotation is present: reads the value of that field, replaces all placeholders in the field value as configured by thePlaceholderannotation instance on the field, and writes back the replaced value to that field. - For each field whose declared type is assignable to 
List<String>and for which aPlaceholderannotation is present, proceed as outlined above for each element in the list. - For each field whose declared type is not assignable to 
List<String>, read the list value of that field and apply this method to each item in the list. 
The presence of a
Placeholderannotation is resolved as follows:- If the field 
declares an annotationof typePlaceholder, that annotation is present. - Otherwise, when the 
declaring classof the fielddeclares an annotationof typePlaceholder, that annotation is present. - Otherwise, if the 
declaring classwas reached during analysis while traversing the field of another class, repeat the above process for that field. - Otherwise, no annotation of 
Placeholderis present 
Placeholderon a field of typeUserCredentials, all string fields in theUserCredentialsare replaced.Placeholder of type
contextare not replaced. If you wish to do that, use thetwo-arg replaceStringFieldsmethod.Note: This method mutates the fields of the passed model instance. This was an intentional decision in accordance with the single responsibility principle to keep cloning logic out of scope for this method. Create a clone and pass it to this method to avoid modifying the original value.
- Parameters:
 model- Model with data that may contain placeholders. This method is a no-op when this isnull.- Throws:
 RuntimeException- When reflective access to a field fails (usually due to aSecurityManager), or when acustomSyntaxprovider could not be instantiated.- See Also:
 Placeholder
 - For each field whose declared type is exactly 
 
- 
replaceStringFields
void replaceStringFields(Object model, IContextReplacerParams contextParams) throws RuntimeException
Replaces all placeholders in the fields of given model, provided they are annotated withPlaceholder.Specifically, this method iterates over all non-static, non-final, non-transient instance fields of the runtime class of the given model, including all its super classes. Access control is ignored, i.e. all public, protected, package-private, and private fields are considered. Then:
- For each field whose declared type is exactly 
Stringand or which aPlaceholderannotation is present: reads the value of that field, replaces all placeholders in the field value as configured by thePlaceholderannotation instance on the field, and writes back the replaced value to that field. - For each field whose declared type is assignable to 
List<String>and for which aPlaceholderannotation is present, proceed as outlined above for each element in the list. - For each field whose declared type is not assignable to 
List<String>, read the list value of that field and apply this method to each item in the list. 
The presence of a
Placeholderannotation is resolved as follows:- If the field 
declares an annotationof typePlaceholder, that annotation is present. - Otherwise, when the 
declaring classof the fielddeclares an annotationof typePlaceholder, that annotation is present. - Otherwise, if the 
declaring classwas reached during analysis while traversing the field of another class, repeat the above process for that field. - Otherwise, no annotation of 
Placeholderis present 
Placeholderon a field of typeUserCredentials, all string fields in theUserCredentialsare replaced.Note: This method mutates the fields of the passed model instance. This was an intentional decision in accordance with the single responsibility principle to keep cloning logic out of scope for this method. Create a clone and pass it to this method to avoid modifying the original value.
- Parameters:
 model- Model with data that may contain placeholders. This method is a no-op when this isnull.contextParams- A map with context values to use for the replacement of context placeholders. Ifnull, no context parameters are replaced.- Throws:
 RuntimeException- When reflective access to a field fails (usually due to aSecurityManager), or when acustomSyntaxprovider could not be instantiated.- See Also:
 Placeholder
 - For each field whose declared type is exactly 
 
- 
replaceSystem
String replaceSystem(String text, IPlaceholderEscaper syntax)
Replaces all system placeholders in the given string.- Parameters:
 text- Text that may contain system placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all system placeholders replaced.
 
 
- 
replaceTemplate
String replaceTemplate(String text, IPlaceholderEscaper syntax)
Replaces all template placeholders in the given string.- Parameters:
 text- Text that may contain template placeholders.syntax- Syntax indicating how placeholders are inserted into the text body.- Returns:
 - The given text, with all template placeholders replaced.
 
 
- 
createReplacerParams
DefaultReplacerParameters createReplacerParams(IContextReplacerParams contextParams)
Creates aDefaultReplacerParameterswith the given replacer context.- Parameters:
 contextParams- the replacer context parameter- Returns:
 DefaultReplacerParameterswith all context references for the replacer process.
 
 - 
 
 -