Class LevelResolver.Builder
java.lang.Object
com.atlassian.oai.validator.report.LevelResolver.Builder
- Enclosing class:
- LevelResolver
A builder for creating
LevelResolver instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Build and return a newLevelResolverinstance created from the configuration collected in this builder.withDefaultLevel(ValidationReport.Level defaultLevel) Set the default level to use for any message which does not have an explicit mapping defined.withLevel(String key, ValidationReport.Level level) Add a mapping of message key -> level to use in theLevelResolver.withLevels(Map<String, ValidationReport.Level> levels) Set mappings of message key -> level to use in theLevelResolver.withLoader(LevelLoader loader) Set or override theLevelLoaderstrategy used to load message levels.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withLoader
Set or override theLevelLoaderstrategy used to load message levels.By default, the
LevelLoader.defaultLoaderChain()is used. If this needs to be overridden, set it tonullhere to avoid any loading, or replace it with your own implementation.- Parameters:
loader- The loader to use to load initial message levels.- Returns:
- this builder instance.
-
withDefaultLevel
Set the default level to use for any message which does not have an explicit mapping defined.Note that any default level set by the loader configured in
withLoader(LevelLoader)will override this value.- Parameters:
defaultLevel- the default level to use for any message which does not have an explicit mapping defined- Returns:
- this builder instance.
-
withLevels
Set mappings of message key -> level to use in theLevelResolver.Note that any mappings loaded from the the loader configured in
withLoader(LevelLoader)will override those set with this method.- Parameters:
levels- mappings of message key -> level to use in theLevelResolver.- Returns:
- this builder instance.
-
withLevel
Add a mapping of message key -> level to use in theLevelResolver.Note that any mappings loaded from the the loader configured in
withLoader(LevelLoader)will override those set with this method.- Parameters:
key- The message keylevel- The level to associate with the key- Returns:
- this builder instance.
-
build
Build and return a newLevelResolverinstance created from the configuration collected in this builder.- Returns:
- The new
LevelResolverinstance.
-