java.lang.Object
nl.pim16aap2.animatedarchitecture.core.tooluser.Step.Factory
Enclosing class:
Step

public static final class Step.Factory extends Object
Factory class for new Step objects.
  • Constructor Details

  • Method Details

    • implicitNextStep

      public Step.Factory implicitNextStep(boolean implicitNextStep)
      Returns:
      The current Factory.
    • stepPreparation

      public Step.Factory stepPreparation(Runnable prepareStep)
      Returns:
      The current Factory.
    • stepExecutor

      public Step.Factory stepExecutor(StepExecutor stepExecutor)
      Returns:
      The current Factory.
    • messageKey

      public Step.Factory messageKey(String messageKey)
      Sets the key of the localized message for this step.

      This is a shortcut for setting a text supplier with a string localized via the localizer.

      Returns:
      The current Factory.
    • textSupplier

      public Step.Factory textSupplier(Function<Text,Text> textSupplier)
      Sets the supplier for the Text object that is used to provide instructions for this step.

      The input of the function is always a new and empty Text object.

      Parameters:
      textSupplier - The function that supplies an instruction Text.
      Returns:
      The current Factory.
    • skipCondition

      public Step.Factory skipCondition(Supplier<Boolean> skipCondition)
      Sets the implementation of Step.skip().

      This can be used to disable certain steps based on arbitrary conditions (e.g. configuration settings).

      Returns:
      The current Factory.
    • waitForUserInput

      public Step.Factory waitForUserInput(boolean waitForUserInput)
      Returns:
      The current Factory.
    • propertyName

      public Step.Factory propertyName(@Nullable @Nullable String name)
      Sets the name of the property to be used when reporting the result of this step to the user.

      The value that will be reported is retrieved using the supplier set via propertyValueSupplier(Supplier).

      Set to null to disable reporting this step.

      Parameters:
      name - The localized name.
      Returns:
      The current Factory.
    • propertyValueSupplier

      public Step.Factory propertyValueSupplier(@Nullable @Nullable Supplier<?> propertyValueSupplier)
      Sets the supplier for the value of the property that was modified by this step when reporting the result of this step to the user.

      The name of the value is retrieved using propertyName(String).

      Set to null to disable reporting this step.

      Parameters:
      propertyValueSupplier - The supplier for the field.
      Returns:
      The current Factory.
    • updatable

      public Step.Factory updatable(boolean updatable)
      Sets whether this step can be updated after it has been set.

      This is used for the review step, where the user can review the selected settings and revisit those that they would like to change.

      This setting has no effect when either propertyValueSupplier(Supplier) or propertyName(String) is null.

      Parameters:
      updatable - True if this step can be updated.
      Returns:
      The current Factory.
    • construct

      public Step construct() throws InstantiationException
      Creates the new Step object using the provided values.
      Returns:
      The new Step object.
      Throws:
      InstantiationException - When this method is called but neither the step executor nor the message key is set.