Package de.xima.fc.workflow.parser.infix
Class ValidationOptions.Builder
- java.lang.Object
-
- de.xima.fc.workflow.parser.infix.ValidationOptions.Builder
-
- All Implemented Interfaces:
org.apache.commons.lang3.builder.Builder<IValidationOptions>
- Enclosing class:
- ValidationOptions
public static class ValidationOptions.Builder extends Object implements org.apache.commons.lang3.builder.Builder<IValidationOptions>
Builder for configuring anIValidationOptions
object.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationOptions.Builder
addKnownVariables(Iterable<String> variableNames)
ValidationOptions.Builder
addKnownVariables(String... variableNames)
IValidationOptions
build()
ValidationOptions.Builder
locale(Locale locale)
ValidationOptions.Builder
treatExtraneousVariablesAsError(boolean treatExtraneousVariablesAsError)
ValidationOptions.Builder
treatNonExistingVariablesAsError(boolean treatNonExistingVariablesAsError)
ValidationOptions.Builder
variableExistenceCheck(Function<String,Boolean> check)
-
-
-
Method Detail
-
addKnownVariables
public ValidationOptions.Builder addKnownVariables(Iterable<String> variableNames)
- Parameters:
variableNames
- Variable names to add to the list of all variables that are definitely known to exist. Note that this is overridden by the result ofValidationOptions.getVariableExistenceCheck()
when that return a non-null value.- Returns:
- this for chaining.
-
addKnownVariables
public ValidationOptions.Builder addKnownVariables(String... variableNames)
- Parameters:
variableNames
- Variable names to add to the list of all variables that are definitely known to exist. Note that this is overridden by the result ofValidationOptions.getVariableExistenceCheck()
when that return a non-null value.- Returns:
- this for chaining.
-
build
public IValidationOptions build()
- Specified by:
build
in interfaceorg.apache.commons.lang3.builder.Builder<IValidationOptions>
-
locale
public ValidationOptions.Builder locale(Locale locale)
- Parameters:
locale
- Locale used for localizing validation messages.- Returns:
- this for chaining.
-
treatExtraneousVariablesAsError
public ValidationOptions.Builder treatExtraneousVariablesAsError(boolean treatExtraneousVariablesAsError)
- Parameters:
treatExtraneousVariablesAsError
-true
to create messages with severityFCMessage.ESeverity.ERROR
when a variable is found that does not occur in the expression, orfalse
to create messages withFCMessage.ESeverity.WARN
.- Returns:
- this for chaining.
-
treatNonExistingVariablesAsError
public ValidationOptions.Builder treatNonExistingVariablesAsError(boolean treatNonExistingVariablesAsError)
- Parameters:
treatNonExistingVariablesAsError
-true
to create messages with severityFCMessage.ESeverity.ERROR
when a variable that occurs in the expression does not exist, orfalse
to create messages withFCMessage.ESeverity.WARN
.- Returns:
- this for chaining.
-
variableExistenceCheck
public ValidationOptions.Builder variableExistenceCheck(Function<String,Boolean> check)
- Parameters:
check
- A test that, given the name of a variable, checks whether that variable exists. This can be used for dynamic variables. When this returnsnull
, the result ofValidationOptions.getKnownVariables()
is used instead. When notnull
, the result of this check overrides the result ofValidationOptions.getKnownVariables()
. Must returntrue
when the variable exists,false
when the variable does not exist, andnull
when not certain whether it exists.- Returns:
- this for chaining.
-
-