Class ExecutionConfig
- java.lang.Object
-
- com.networknt.schema.ExecutionConfig
-
public class ExecutionConfig extends java.lang.Object
Configuration per execution.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
annotationCollectionEnabled
Determines if annotation collection is enabled.private java.util.function.Predicate<java.lang.String>
annotationCollectionFilter
If annotation collection is enabled, determine which annotations to collect.private boolean
debugEnabled
Determine if debugging features such that logging are switched on.private boolean
failFast
Determine if the validation execution can fail fast.private java.lang.Boolean
formatAssertionsEnabled
Since Draft 2019-09 format assertions are not enabled by default.private java.util.Locale
locale
The locale to use for formatting messages.
-
Constructor Summary
Constructors Constructor Description ExecutionConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Predicate<java.lang.String>
getAnnotationCollectionFilter()
Gets the predicate to determine if annotation collection is allowed for a particular keyword.java.lang.Boolean
getFormatAssertionsEnabled()
Gets the format assertion enabled flag.java.util.Locale
getLocale()
Gets the locale to use for formatting messages.boolean
isAnnotationCollectionEnabled()
Return if annotation collection is enabled.boolean
isDebugEnabled()
Gets if debugging features such as logging is switched on.boolean
isFailFast()
Return if fast fail is enabled.void
setAnnotationCollectionEnabled(boolean annotationCollectionEnabled)
Sets whether the annotation collection is enabled.void
setAnnotationCollectionFilter(java.util.function.Predicate<java.lang.String> annotationCollectionFilter)
Predicate to determine if annotation collection is allowed for a particular keyword.void
setDebugEnabled(boolean debugEnabled)
Sets if debugging features such as logging is switched on.void
setFailFast(boolean failFast)
Sets whether fast fail is enabled.void
setFormatAssertionsEnabled(java.lang.Boolean formatAssertionsEnabled)
Sets the format assertion enabled flag.void
setLocale(java.util.Locale locale)
Sets the locale to use for formatting messages.
-
-
-
Field Detail
-
locale
private java.util.Locale locale
The locale to use for formatting messages.
-
annotationCollectionEnabled
private boolean annotationCollectionEnabled
Determines if annotation collection is enabled.This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
-
annotationCollectionFilter
private java.util.function.Predicate<java.lang.String> annotationCollectionFilter
If annotation collection is enabled, determine which annotations to collect.This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
-
formatAssertionsEnabled
private java.lang.Boolean formatAssertionsEnabled
Since Draft 2019-09 format assertions are not enabled by default.
-
failFast
private boolean failFast
Determine if the validation execution can fail fast.
-
debugEnabled
private boolean debugEnabled
Determine if debugging features such that logging are switched on.This is turned off by default. This is present because the library attempts to log debug logs at each validation node and the logger evaluation on whether the logger is turned on is impacting performance.
-
-
Method Detail
-
getLocale
public java.util.Locale getLocale()
Gets the locale to use for formatting messages.- Returns:
- the locale
-
setLocale
public void setLocale(java.util.Locale locale)
Sets the locale to use for formatting messages.- Parameters:
locale
- the locale
-
getFormatAssertionsEnabled
public java.lang.Boolean getFormatAssertionsEnabled()
Gets the format assertion enabled flag.This defaults to null meaning that it will follow the defaults of the specification.
Since draft 2019-09 this will default to false unless enabled by using the $vocabulary keyword.
- Returns:
- the format assertions enabled flag
-
setFormatAssertionsEnabled
public void setFormatAssertionsEnabled(java.lang.Boolean formatAssertionsEnabled)
Sets the format assertion enabled flag.- Parameters:
formatAssertionsEnabled
- the format assertions enabled flag
-
isFailFast
public boolean isFailFast()
Return if fast fail is enabled.- Returns:
- if fast fail is enabled
-
setFailFast
public void setFailFast(boolean failFast)
Sets whether fast fail is enabled.- Parameters:
failFast
- true to fast fail
-
isAnnotationCollectionEnabled
public boolean isAnnotationCollectionEnabled()
Return if annotation collection is enabled.This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
The annotations to collect can be customized using the annotation collection predicate.
- Returns:
- if annotation collection is enabled
-
setAnnotationCollectionEnabled
public void setAnnotationCollectionEnabled(boolean annotationCollectionEnabled)
Sets whether the annotation collection is enabled.This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
The annotations to collect can be customized using the annotation collection predicate.
- Parameters:
annotationCollectionEnabled
- true to enable annotation collection
-
getAnnotationCollectionFilter
public java.util.function.Predicate<java.lang.String> getAnnotationCollectionFilter()
Gets the predicate to determine if annotation collection is allowed for a particular keyword. This only has an effect if annotation collection is enabled.The default value is to not collect any annotation keywords if annotation collection is enabled.
This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
- Returns:
- the predicate to determine if annotation collection is allowed for the keyword
-
setAnnotationCollectionFilter
public void setAnnotationCollectionFilter(java.util.function.Predicate<java.lang.String> annotationCollectionFilter)
Predicate to determine if annotation collection is allowed for a particular keyword. This only has an effect if annotation collection is enabled.The default value is to not collect any annotation keywords if annotation collection is enabled.
This does not affect annotation collection required for evaluating keywords such as unevaluatedItems or unevaluatedProperties and only affects reporting.
- Parameters:
annotationCollectionFilter
- the predicate accepting the keyword
-
isDebugEnabled
public boolean isDebugEnabled()
Gets if debugging features such as logging is switched on.- Returns:
- true if debug is enabled
-
setDebugEnabled
public void setDebugEnabled(boolean debugEnabled)
Sets if debugging features such as logging is switched on.- Parameters:
debugEnabled
- true to enable debug
-
-