Record Class MapContextPlan<C,D>

java.lang.Object
java.lang.Record
dev.engine_room.flywheel.lib.task.MapContextPlan<C,D>
All Implemented Interfaces:
Plan<C>, SimplyComposedPlan<C>

public record MapContextPlan<C,D>(SupplierWithContext<C,D> map, Plan<D> plan) extends Record implements SimplyComposedPlan<C>
  • Constructor Details

    • MapContextPlan

      public MapContextPlan(SupplierWithContext<C,D> map, Plan<D> plan)
      Creates an instance of a MapContextPlan record class.
      Parameters:
      map - the value for the map record component
      plan - the value for the plan record component
  • Method Details

    • map

      public static <C, D> MapContextPlan.Builder<C,D> map(SupplierWithContext<C,D> map)
    • get

      public static <C, D> MapContextPlan.Builder<C,D> get(SupplierWithContext.Ignored<C,D> map)
    • execute

      public void execute(TaskExecutor taskExecutor, C context, Runnable onCompletion)
      Description copied from interface: Plan
      Submit this plan for execution.

      You must call onCompletion.run() when the plan has completed execution.

      Specified by:
      execute in interface Plan<C>
      Parameters:
      taskExecutor - The executor to use for submitting tasks.
      context - An arbitrary context object that the plan wants to use at runtime.
      onCompletion - A callback to run when the plan has completed execution, useful for chaining plans.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • map

      public SupplierWithContext<C,D> map()
      Returns the value of the map record component.
      Returns:
      the value of the map record component
    • plan

      public Plan<D> plan()
      Returns the value of the plan record component.
      Returns:
      the value of the plan record component