Interface Initializer<T>

Type Parameters:
T - a type of object to be initialized
All Superinterfaces:
Consumer<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Initializer<T> extends Consumer<T>
An initializer of some value

Basically, a consumer of some object that should initialize that object

This interface is mostly used to initialize objects that follow create().with() pattern which you can find throughout a codebase

  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static <T> Initializer<T>
    combine(Initializer<? super T>... initializers)
    Combines multiple initializers into a single initializers that initializes an object by calling each given serializer in order
    static <T> Initializer<T>
    combine(Iterable<? extends Initializer<? super T>> initializers)
    Combines multiple initializers into a single initializers that initializes an object by calling each given serializer in order

    Methods inherited from interface java.util.function.Consumer

    accept, andThen
  • Method Details

    • combine

      @SafeVarargs static <T> Initializer<T> combine(Initializer<? super T>... initializers)
      Combines multiple initializers into a single initializers that initializes an object by calling each given serializer in order
      Type Parameters:
      T - a type of object to be initialized
      Parameters:
      initializers - an array of initializers to be combined into a single initializer
      Returns:
      a combined initializer
    • combine

      static <T> Initializer<T> combine(Iterable<? extends Initializer<? super T>> initializers)
      Combines multiple initializers into a single initializers that initializes an object by calling each given serializer in order
      Type Parameters:
      T - a type of object to be initialized
      Parameters:
      initializers - an iterable of initializers to be combined into a single initializer
      Returns:
      a combined initializer