Class Config.Builder

Enclosing class:
Config

public static class Config.Builder extends Context.Builder<Config.Builder>
Builder class.
  • Constructor Details

    • Builder

      protected Builder()
      Constructor, default settings.
    • Builder

      protected Builder(Config.Builder copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The builder to copy from.
      Cannot be null.
    • Builder

      protected Builder(Config copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean to copy from.
      Cannot be null.
  • Method Details

    • binaryFormat

      Binary value format.

      The format to use when persisting byte arrays.

      Parameters:
      value - The new value for this property.
      The default is the first value found:
      • System property "Config.binaryFormat"
      • Environment variable "CONFIG_BINARYFORMAT"
      • BinaryFormat.BASE64

      Cannot be null.
      Returns:
      This object.
    • binaryLineLength

      public Config.Builder binaryLineLength(int value)
      Binary value line length.

      When serializing binary values, lines will be split after this many characters.
      Use -1 to represent no line splitting.

      Parameters:
      value - The new value for this property.
      The default is the first value found:
      • System property "Config.binaryLineLength"
      • Environment variable "CONFIG_BINARYLINELENGTH"
      • -1
      Returns:
      This object.
    • build

      public Config build()
      Description copied from class: Context.Builder
      Build the object.
      Overrides:
      build in class Context.Builder<Config.Builder>
      Returns:
      The built object.
    • copy

      public Config.Builder copy()
      Description copied from class: Context.Builder
      Copy creator.
      Specified by:
      copy in class Context.Builder<Config.Builder>
      Returns:
      A new mutable copy of this builder.
    • memStore

      Configuration store.

      Convenience method for calling store(ConfigMemoryStore.DEFAULT).

      Returns:
      This object.
    • mods

      public Config.Builder mods(Mod... values)
      Adds a value modifier.

      Modifiers are used to modify entry value before being persisted.

      Parameters:
      values - The mods to apply to this config.
      Cannot contain null values.
      Returns:
      This object.
    • multiLineValuesOnSeparateLines

      Multi-line values on separate lines.

      When enabled, multi-line values will always be placed on a separate line from the key.

      The default is the first value found:

      • System property "Config.multiLineValuesOnSeparateLine"
      • Environment variable "CONFIG_MULTILINEVALUESONSEPARATELINE"
      • false
      Returns:
      This object.
    • name

      public Config.Builder name(String value)
      Configuration name.

      Specifies the configuration name.
      This is typically the configuration file name, although the name can be anything identifiable by the ConfigStore used for retrieving and storing the configuration.

      Parameters:
      value - The new value for this property.
      The default is the first value found:
      • System property "Config.name"
      • Environment variable "CONFIG_NAME"
      • "Configuration.cfg"

      Cannot be null.
      Returns:
      This object.
    • profiles

      public Config.Builder profiles(String... value)
      Active configuration profiles.

      Each active profile P activates a <name>-P overlay (e.g. base my.cfg + profile stage → my-stage.cfg) layered over the base config: profile entries win over base, and for multiple active profiles the last one wins. YAML bases use <name>-P.yml overlays the same way. Overlays are resolved through the configured store, so live-reload fires when either the base or an active profile file changes.

      Defaults to the comma-separated value of juneau.profiles.active (system property, environment variable — with relaxed binding — or config key). Pass no arguments / an empty array to disable profiles.

      Parameters:
      value - The active profile names, in activation order.
      May be empty.
      Can be null (treated as no active profiles).
      Returns:
      This object.
      Since:
      10.0.0
    • format

      Configuration format.
      Parameters:
      value - The format. Can be null to auto-detect from the config name extension.
      Returns:
      This object.
    • yaml

      public Config.Builder yaml()
      Sets YAML format.
      Returns:
      This object.
    • ini

      public Config.Builder ini()
      Sets INI format.
      Returns:
      This object.
    • parser

      POJO parser.

      The parser to use for parsing values to POJOs.

      Parameters:
      value - The new value for this property.
      The default is JsonParser.DEFAULT.
      Cannot be null.
      Returns:
      This object.
    • readOnly

      Read-only mode.

      When enabled, attempts to call any setters on this object will throw an UnsupportedOperationException.

      The default is the first value found:

      • System property "Config.readOnly"
      • Environment variable "CONFIG_READONLY"
      • false
      Returns:
      This object.
    • serializer

      POJO serializer.

      The serializer to use for serializing POJO values.

      Parameters:
      value - The new value for this property.
      The default is Json5Serializer.DEFAULT
      Cannot be null.
      Returns:
      This object.
    • store

      Configuration store.

      The configuration store used for retrieving and storing configurations.

      Parameters:
      value - The new value for this property.
      The default is FileStore.DEFAULT.
      Cannot be null.
      Returns:
      This object.
    • varResolver

      SVL variable resolver.

      The resolver to use for resolving SVL variables.

      Parameters:
      value - The new value for this property.
      The default is VarResolver.DEFAULT.
      Cannot be null.
      Returns:
      This object.