Class While<I,​O>

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Input<I>, InputOutput<I,​O>, Output<O>, Operation, Operations<Operation>

    public class While<I,​O>
    extends GenericInput<I>
    implements InputOutput<I,​O>, Operations<Operation>
    A While is an Operation which executes a provided delegate Operation, either while some condition is true, (upto some global maximum), or until some configurable cut-off is reached.

    The condition can either be in the form of anything that resolves to a boolean, or a Conditional can be provided, to control the operation based upon the input object itself. This allows the input to be transformed non-destructively, before it is passed to the Predicate contained within the Conditional.

    N.B. Only one of the condition and conditional can be set - attempting to configure both will throw an exception.

    By default, the operation is configured with a large number of repeats, which will need altering using setMaxRepeats(int).

    • Constructor Detail

      • While

        public While()
    • Method Detail

      • getOutputTypeReference

        public com.fasterxml.jackson.core.type.TypeReference<O> getOutputTypeReference()
        Specified by:
        getOutputTypeReference in interface Output<I>
      • shallowClone

        public While<I,​O> shallowClone()
        Description copied from interface: Operation
        Operation implementations should ensure a ShallowClone method is implemented. Performs a shallow clone. Creates a new instance and copies the fields across. It does not clone the fields. If the operation contains nested operations, these must also be cloned.
        Specified by:
        shallowClone in interface Operation
        Returns:
        shallow clone
      • updateOperations

        public void updateOperations​(Collection<Operation> operations)
        Description copied from interface: Operations
        Updates the operations using the provided collection. By default this will just clear the current operations collection and add all the new operations.
        Specified by:
        updateOperations in interface Operations<I>
        Parameters:
        operations - the new operations.
      • validate

        public uk.gov.gchq.koryphe.ValidationResult validate()
        Description copied from interface: Operation
        Validates an operation. This should be used to validate that fields have been be configured correctly. By default no validation is applied. Override this method to implement validation.
        Specified by:
        validate in interface Operation
        Returns:
        validation result.
      • getOptions

        public Map<String,​String> getOptions()
        Specified by:
        getOptions in interface Operation
        Returns:
        the operation options. This may contain store specific options such as authorisation strings or and other properties required for the operation to be executed. Note these options will probably not be interpreted in the same way by every store implementation.
      • setOptions

        public void setOptions​(Map<String,​String> options)
        Specified by:
        setOptions in interface Operation
        Parameters:
        options - the operation options. This may contain store specific options such as authorisation strings or and other properties required for the operation to be executed. Note these options will probably not be interpreted in the same way by every store implementation.
      • setOperation

        public void setOperation​(Operation op)
      • setConditional

        public void setConditional​(Conditional conditional)
      • getOperation

        public Operation getOperation()
      • getMaxRepeats

        public int getMaxRepeats()
      • setMaxRepeats

        public void setMaxRepeats​(int maxRepeats)
      • isCondition

        public Boolean isCondition()
      • setCondition

        public void setCondition​(Boolean condition)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object