Class LevelResolver
java.lang.Object
com.atlassian.oai.validator.report.LevelResolver
Resolves the
ValidationReport.Level for a given message key.
Levels are specified hierarchically - if a level is not found for the given key it
will inherit the level of its parent key. If no level is found for any parent key the
defaultLevel will be returned.
For example:
validation.request=ERROR
validation.request.body=WARN
getLevel("validation.request.body.missing") == WARN
getLevel("validation.request.parameter.query.missing") == ERROR
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic LevelResolver.Buildercreate()Create a newLevelResolverinstance using a builder to obtain configuration.static LevelResolverCreate a new defaultLevelResolver.Gets theValidationReport.Levelfor the given message key.
-
Method Details
-
create
Create a newLevelResolverinstance using a builder to obtain configuration.- Returns:
- a new builder to use for creating
LevelResolverinstances.
-
defaultResolver
Create a new defaultLevelResolver.This resolver will load levels using the
LevelLoader.defaultLoaderChain()and apply a default level ofValidationReport.Level.ERROR.- Returns:
- a new
LevelResolverwith default configuration.
-
getLevel
Gets theValidationReport.Levelfor the given message key.Levels are specified hierarchically - if a level is not found for the given key it will inherit the level of its parent key. If no level is found for any parent key the
defaultLevelwill be returned.For example:
validation.request=ERROR validation.request.body=WARN getLevel("validation.request.body.missing") == WARN getLevel("validation.request.parameter.query.missing") == ERROR- Parameters:
key- the message key to resolve e.g."validation.request.body.missing"- Returns:
- The level to use for the given message key
-