Interface Builder<T>

Type Parameters:
T - This builder creates instances of this class.
All Superinterfaces:
Supplier<T>

public interface Builder<T> extends Supplier<T>
A type of builder that can be used to configure and create a instances using a Java DSL instead of through a configuration file. These builders are primarily useful for internal code and unit tests, but they can technically be used as a verbose alternative to configuration files.

When creating plugin builders, it is customary to create the builder class as a public static inner class called Builder. For instance, the builder class for org.apache.logging.log4j.core.layout.PatternLayout PatternLayout would be PatternLayout.Builder.

  • Method Summary

    Modifier and Type
    Method
    Description
    Builds the object after all configuration has been set.
    default T
    get()
     
  • Method Details

    • build

      T build()
      Builds the object after all configuration has been set. This will use default values for any unspecified attributes for the object.
      Returns:
      the configured instance. object.
    • get

      default T get()
      Specified by:
      get in interface Supplier<T>