Class TemplateProcessing
- java.lang.Object
-
- com.epam.reportportal.utils.formatting.templating.TemplateProcessing
-
public class TemplateProcessing extends java.lang.ObjectClass for processing simple string templates.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNULL_VALUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringprocessTemplate(java.lang.String pattern, java.lang.Object object, java.lang.reflect.Executable executable, java.util.Map<java.lang.String,java.lang.Object> parameters, TemplateConfiguration config)Format given pattern with given parameters and configuration.static java.lang.StringprocessTemplate(java.lang.String pattern, java.util.Map<java.lang.String,java.lang.Object> parameters, TemplateConfiguration config)Format given pattern with given parameters and configuration.static java.lang.StringretrieveValue(TemplateConfiguration templateConfig, int index, java.lang.String[] fields, java.lang.Object object)Example: fields = {"object", "names", "hash"} from 'template part' = {object.names.hash} templateConfig - default
-
-
-
Field Detail
-
NULL_VALUE
public static final java.lang.String NULL_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
processTemplate
public static java.lang.String processTemplate(@Nonnull java.lang.String pattern, @Nullable java.lang.Object object, @Nullable java.lang.reflect.Executable executable, @Nullable java.util.Map<java.lang.String,java.lang.Object> parameters, @Nonnull TemplateConfiguration config)Format given pattern with given parameters and configuration.- Parameters:
pattern- text patter to formatobject- current object contextexecutable- current execution contextparameters- a map which will be used to locate reference replacements in patternconfig- templating mechanism configuration- Returns:
- formatted string
-
processTemplate
public static java.lang.String processTemplate(@Nonnull java.lang.String pattern, @Nullable java.util.Map<java.lang.String,java.lang.Object> parameters, @Nonnull TemplateConfiguration config)Format given pattern with given parameters and configuration.- Parameters:
pattern- text patter to formatparameters- a map which will be used to locate reference replacements in patternconfig- templating mechanism configuration- Returns:
- formatted string
-
retrieveValue
public static java.lang.String retrieveValue(@Nonnull TemplateConfiguration templateConfig, int index, @Nonnull java.lang.String[] fields, @Nullable java.lang.Object object) throws java.lang.ThrowableExample: fields = {"object", "names", "hash"} from 'template part' = {object.names.hash} templateConfig - defaultGiven: object - some object names - the
Listcontaining 3Stringobjects with hashes: {25,32,57} hash - field, which value should be retrievedResult: "[25,32,57]"
- Parameters:
templateConfig-TemplateConfigurationfor result formattingindex- Index of the current field, from the template partfields- Fields of the template partobject- Value of the current field- Returns:
Stringrepresentation of object field(s) value(s).- Throws:
java.lang.NoSuchFieldException- if field not foundjava.lang.Throwable
-
-