Class BuilderArgument<T>

java.lang.Object
fr.flowarg.flowupdater.utils.builderapi.BuilderArgument<T>
Type Parameters:
T - Object Argument

public class BuilderArgument<T> extends Object
Builder API; Represent an argument for a Builder implementation.
  • Constructor Details

    • BuilderArgument

      public BuilderArgument(String objectName, @NotNull @NotNull Supplier<T> initialValue)
      Construct a new BuilderArgument.
      Parameters:
      objectName - The name of the object.
      initialValue - The initial value's wrapper.
    • BuilderArgument

      public BuilderArgument(String objectName)
      Construct a new basic BuilderArgument.
      Parameters:
      objectName - The name of the object.
    • BuilderArgument

      public BuilderArgument(String objectName, @NotNull @NotNull Supplier<T> initialValue, @NotNull @NotNull Supplier<T> badObject)
      Construct a new BuilderArgument.
      Parameters:
      objectName - The name of the object.
      initialValue - The initial value's wrapper.
      badObject - The initial bad value's wrapper.
    • BuilderArgument

      public BuilderArgument(@NotNull @NotNull Supplier<T> badObject, String objectName)
      Construct a new BuilderArgument.
      Parameters:
      badObject - The initial bad value's wrapper.
      objectName - The name of the object.
  • Method Details

    • get

      public T get() throws BuilderException
      Check and get the wrapped object.
      Returns:
      the wrapper object.
      Throws:
      BuilderException - it the builder configuration is invalid.
    • set

      public void set(T object)
      Define the new wrapped object.
      Parameters:
      object - the new wrapper object to define.
    • require

      public BuilderArgument<T> require(BuilderArgument<?> @NotNull ... required)
      Indicate that provided arguments are required if this argument is built.
      Parameters:
      required - required arguments.
      Returns:
      this.
    • required

      public BuilderArgument<T> required()
      Indicate that argument is required.
      Returns:
      this.
    • optional

      public BuilderArgument<T> optional()
      Indicate that argument is optional.
      Returns:
      this.
    • getObjectName

      public String getObjectName()
      Get the name of the current object's name.
      Returns:
      the object's name.
    • badObject

      public T badObject()
      Get the bad object.
      Returns:
      the bad object.
    • toString

      public String toString()
      Overrides:
      toString in class Object