Class LevelResolver.Builder

java.lang.Object
com.atlassian.oai.validator.report.LevelResolver.Builder
Enclosing class:
LevelResolver

public static class LevelResolver.Builder extends Object
A builder for creating LevelResolver instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withLoader

      public LevelResolver.Builder withLoader(LevelLoader loader)
      Set or override the LevelLoader strategy used to load message levels.

      By default, the LevelLoader.defaultLoaderChain() is used. If this needs to be overridden, set it to null here 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

      public LevelResolver.Builder withDefaultLevel(ValidationReport.Level defaultLevel)
      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 the LevelResolver.

      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 the LevelResolver.
      Returns:
      this builder instance.
    • withLevel

      public LevelResolver.Builder withLevel(String key, ValidationReport.Level level)
      Add a mapping of message key -> level to use in the LevelResolver.

      Note that any mappings loaded from the the loader configured in withLoader(LevelLoader) will override those set with this method.

      Parameters:
      key - The message key
      level - The level to associate with the key
      Returns:
      this builder instance.
    • build

      public LevelResolver build()
      Build and return a new LevelResolver instance created from the configuration collected in this builder.
      Returns:
      The new LevelResolver instance.