Package com.norconex.commons.lang.config

# Interface Configurable<T>

Type Parameters:
  `T` - The configuration class type

public interface Configurable<T>
The implementing class can be configured via the object returned by `getConfiguration()`. Provides a consistent way to obtain a file configuration dynamically. Could be useful for object mapping, for instance.

Since:
  3.0.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `PROPERTY`
  Practical constant for the string representation of the "configuration" property.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <T, R extends Configurable<T>>
  R`
  `configure(R configurable, Consumer<T>... configurers)`
  Convenience method to facilitate configuring this instance in method chaining.
  `T`
  `getConfiguration()`
  Gets the configuration for a configurable object.

- ## Field Details

  - ### PROPERTY

    static final String PROPERTY
    Practical constant for the string representation of the "configuration" property.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getConfiguration

    T getConfiguration()
    Gets the configuration for a configurable object. Never `null`.
    Returns:
      configuration

  - ### configure

    @SafeVarargs static <T, R extends Configurable<T>> R configure(R configurable, Consumer<T>... configurers)

    Convenience method to facilitate configuring this instance in method chaining. E.g.

         var myClass = Configurable.configure(
              new MyConfigurableClass(), cfg -> cfg.setSomeValue("my value"));

    You can supply multiple consumers and they'll all be executed in the order provided. This is an alternative to using lambda `Consumer.andThen(Consumer)` without the need for casting.

    Parameters:
      `configurable` - the configurable object
      `configurers` - one or more object configuration consumers (not invoked if `null` or if the configuration is `null`)
    Returns:
      this instance