Package org.springframework.batch.repeat.interceptor

# Class RepeatOperationsInterceptor

java.lang.Object
org.springframework.batch.repeat.interceptor.RepeatOperationsInterceptor

All Implemented Interfaces:
  `org.aopalliance.aop.Advice`, `org.aopalliance.intercept.Interceptor`, `org.aopalliance.intercept.MethodInterceptor`

public class RepeatOperationsInterceptor extends Object implements org.aopalliance.intercept.MethodInterceptor
A `MethodInterceptor` that can be used to automatically repeat calls to a method on a service. The injected `RepeatOperations` is used to control the completion of the loop. Independent of the completion policy in the `RepeatOperations` the loop will repeat until the target method returns null or false. Be careful when injecting a bespoke `RepeatOperations` that the loop will actually terminate, because the default policy for a vanilla `RepeatTemplate` will never complete if the return type of the target method is void (the value returned is always not-null, representing the `Void.TYPE`).

Author:
  Dave Syer

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RepeatOperationsInterceptor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `invoke(org.aopalliance.intercept.MethodInvocation invocation)`
  Invoke the proceeding method call repeatedly, according to the properties of the injected `RepeatOperations`.
  `void`
  `setRepeatOperations(RepeatOperations batchTemplate)`
  Setter for the `RepeatOperations`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RepeatOperationsInterceptor

    public RepeatOperationsInterceptor()

- ## Method Details

  - ### setRepeatOperations

    public void setRepeatOperations(RepeatOperations batchTemplate)
    Setter for the `RepeatOperations`.
    Parameters:
      `batchTemplate` - template to be used
    Throws:
      `IllegalArgumentException` - if the argument is null.

  - ### invoke

    public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
    Invoke the proceeding method call repeatedly, according to the properties of the injected `RepeatOperations`.
    Specified by:
      `invoke` in interface `org.aopalliance.intercept.MethodInterceptor`
    Throws:
      `Throwable`
    See Also:
      - `MethodInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)`