org.springframework.batch.repeat.policy

## Class CompositeCompletionPolicy

- java.lang.Object
- - org.springframework.batch.repeat.policy.CompositeCompletionPolicy

- All Implemented Interfaces:
    CompletionPolicy

      public class CompositeCompletionPolicy
      extends java.lang.Object
      implements CompletionPolicy

  Composite policy that loops through a list of delegate policies and answers calls by a consensus.
  Author:
    Dave Syer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `CompositeCompletionPolicy.CompositeBatchContext` Composite context that knows about the policies and contexts is was created with.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeCompletionPolicy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isComplete(RepeatContext context)` This policy is complete if any of the composed policies is complete.
    `boolean` | `isComplete(RepeatContext context, RepeatStatus result)` This policy is complete if any of the composed policies is complete.
    `void` | `setPolicies(CompletionPolicy[] policies)` Setter for the policies.
    `RepeatContext` | `start(RepeatContext context)` Create a new composite context from all the available policies.
    `void` | `update(RepeatContext context)` Update all the composed contexts, and also increment the parent context.

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

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

- - ### Constructor Detail

    - #### CompositeCompletionPolicy

          public CompositeCompletionPolicy()

  - ### Method Detail

    - #### setPolicies

          public void setPolicies(CompletionPolicy[] policies)

      Setter for the policies.
      Parameters:
        `policies` -

    - #### isComplete

          public boolean isComplete(RepeatContext context,
                                    RepeatStatus result)

      This policy is complete if any of the composed policies is complete.
      Specified by:
        `isComplete` in interface `CompletionPolicy`
      Parameters:
        `context` - the current batch context.
        `result` - the result of the latest batch item processing.
      Returns:
        true if the batch should terminate.
      See Also:
        `CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext, RepeatStatus)`

    - #### isComplete

          public boolean isComplete(RepeatContext context)

      This policy is complete if any of the composed policies is complete.
      Specified by:
        `isComplete` in interface `CompletionPolicy`
      Parameters:
        `context` - the current batch context.
      Returns:
        true if the batch should terminate.
      See Also:
        `CompletionPolicy.isComplete(org.springframework.batch.repeat.RepeatContext)`

    - #### start

          public RepeatContext start(RepeatContext context)

      Create a new composite context from all the available policies.
      Specified by:
        `start` in interface `CompletionPolicy`
      Parameters:
        `context` - the current context if one is already in progress.
      Returns:
        a context object that can be used by the implementation to store internal state for a batch.
      See Also:
        `CompletionPolicy.start(RepeatContext)`

    - #### update

          public void update(RepeatContext context)

      Update all the composed contexts, and also increment the parent context.
      Specified by:
        `update` in interface `CompletionPolicy`
      Parameters:
        `context` - the value returned by start.
      See Also:
        `CompletionPolicy.update(org.springframework.batch.repeat.RepeatContext)`