Package com.complexible.common.base

# Class PropertiesBuilder

java.lang.Object
com.complexible.common.base.PropertiesBuilder

public final class PropertiesBuilder extends Object

Simple builder class for creating instances of `Properties`

Since:
  0.3
Version:
  2.2.1
Author:
  Michael Grove

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `final class`
  `PropertiesBuilder.PrefixedPropertiesBuilder`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Properties`
  `build()`
  Return the created Properties instance
  `static PropertiesBuilder`
  `create()`
  Create a new PropertiesBuilder
  `static Properties`
  `create(String... optionPairs)`
  `static PropertiesBuilder`
  `create(Path theSource)`
  Create a new PropertiesBuilder
  `static PropertiesBuilder`
  `create(Properties theProps)`
  Create a new PropertiesBuilder
  `String`
  `get(String theKey)`
  Get the specified property from this builder.
  `static Properties`
  `propertiesFromFile(Path theSource)`
  `static Properties`
  `propertiesFromString(String theContents)`
  `static String`
  `propertiesToString(Properties properties)`
  `static String`
  `propertiesToString(Properties properties, boolean includeTimestamp)`
  `PropertiesBuilder`
  `remove(String theKey)`
  Remove the specified property
  `PropertiesBuilder`
  `set(String theKey, String theValue)`
  Set the specified property key-value pair
  `PropertiesBuilder`
  `setFalse(String theKey)`
  `PropertiesBuilder`
  `setTrue(String theKey)`
  `String`
  `toString()`
  `PropertiesBuilder.PrefixedPropertiesBuilder`
  `withPrefix(String thePrefix)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### create

    public static PropertiesBuilder create()
    Create a new PropertiesBuilder
    Returns:
      a new builder

  - ### create

    public static PropertiesBuilder create(Properties theProps)
    Create a new PropertiesBuilder
    Parameters:
      `theProps` - create a new builder starting from the provided set of properties. A copy of these properties are made, the original remains unaltered by the builder.
    Returns:
      a new builder

  - ### create

    public static PropertiesBuilder create(Path theSource)
    Create a new PropertiesBuilder
    Parameters:
      `theSource` - create a new builder starting from the provided properties file.
    Returns:
      a new builder

  - ### create

    public static Properties create(String... optionPairs)

  - ### get

    public String get(String theKey)
    Get the specified property from this builder.
    Parameters:
      `theKey` - the key
    Returns:
      the value or null if not set

  - ### set

    public PropertiesBuilder set(String theKey, String theValue)
    Set the specified property key-value pair
    Parameters:
      `theKey` - the key
      `theValue` - the value
    Returns:
      this builder

  - ### remove

    public PropertiesBuilder remove(String theKey)
    Remove the specified property
    Parameters:
      `theKey` - the key
    Returns:
      this builder

  - ### setTrue

    public PropertiesBuilder setTrue(String theKey)

  - ### setFalse

    public PropertiesBuilder setFalse(String theKey)

  - ### withPrefix

    public PropertiesBuilder.PrefixedPropertiesBuilder withPrefix(String thePrefix)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### build

    public Properties build()
    Return the created Properties instance
    Returns:
      the properties

  - ### propertiesToString

    public static String propertiesToString(Properties properties)

  - ### propertiesToString

    public static String propertiesToString(Properties properties, boolean includeTimestamp)

  - ### propertiesFromString

    public static Properties propertiesFromString(String theContents)

  - ### propertiesFromFile

    public static Properties propertiesFromFile(Path theSource)