Schnittstelle AroundTryHook

Alle Superschnittstellen:
LifecycleHook
Funktionsschnittstelle:
Dies ist eine funktionale Schnittstelle, die somit als Zuweisungsziel für einen Lambdaausdruck oder eine Methodenreferenz verwendet werden kann.

@API(status=MAINTAINED, since="1.4.0") @FunctionalInterface public interface AroundTryHook extends LifecycleHook
Implement this hook to define behaviour that should "wrap" the execution of a single try, i.e., do something directly before or after executing a property method with a given list of parameters. You can even change the result of a try from satisfied to falsified or the other way round.
  • Felddetails

  • Methodendetails

    • aroundTry

      TryExecutionResult aroundTry(TryLifecycleContext context, TryExecutor aTry, List<Object> parameters) throws Throwable
      When you wrap a try you can do stuff before and/or after its execution. All implementors should invoke the try with aTry.execute(parameters) and either return the result of this call or create another result.

      It is possible to manipulate the parameters before invoking aTry.execute(parameters). Never change the number and types of parameters because this will result in runtime errors. Also keep in mind that all manipulation might mess up random generation and shrinking.

      Parameter:
      context - The property's context object
      aTry - executor to call
      parameters - the generated parameters for this try
      Gibt zurück:
      result of running a single try
      Löst aus:
      Throwable
    • aroundTryProximity

      default int aroundTryProximity()
      The higher the value, the closer to the actual property method. Default value is 0.

      Values greater than -10 will make it run "inside" annotated lifecycle methods (BeforeTry and AfterTry).

      Gibt zurück:
      an integer value
    • compareTo

      @API(status=INTERNAL) default int compareTo(AroundTryHook other)