Class Step<T,​U>

java.lang.Object
com.legyver.utils.nippe.AbstractStepExecutor<T>
com.legyver.utils.nippe.Step<T,​U>

public class Step<T,​U>
extends AbstractStepExecutor<T>
decorator-based mechanism for constructing NPE-safe chained getters: see com.legyver.util.nippe.StepTest
Since:
2.0
  • Constructor Summary

    Constructors
    Constructor Description
    Step​(AbstractStepExecutor<U> decorated, java.util.function.Function<U,​T> function)
    Constructor to create a Step
  • Method Summary

    Modifier and Type Method Description
    T execute()
    Take a step Executes the Function if the result of the previous Base/Step is not null

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Step

      public Step​(AbstractStepExecutor<U> decorated, java.util.function.Function<U,​T> function)
      Constructor to create a Step
      Parameters:
      decorated - the previous Step or Base
      function - the function to be evaluated if the node is not null
  • Method Details

    • execute

      public T execute()
      Take a step Executes the Function if the result of the previous Base/Step is not null
      Specified by:
      execute in class AbstractStepExecutor<T>
      Returns:
      null if the result of the previous step is null, the result of the function when applied to the result otherwise