Class While<I,O>
- java.lang.Object
-
- uk.gov.gchq.gaffer.operation.io.GenericInput<I>
-
- uk.gov.gchq.gaffer.operation.impl.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>
AWhile
is anOperation
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 thePredicate
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)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
While.Builder<I,O>
-
Nested classes/interfaces inherited from class uk.gov.gchq.gaffer.operation.io.GenericInput
GenericInput.InputWrapper, GenericInput.InputWrapperNoTypeInfo, GenericInput.MultiInputWrapper
-
Nested classes/interfaces inherited from interface uk.gov.gchq.gaffer.operation.Operation
Operation.BaseBuilder<OP extends Operation,B extends Operation.BaseBuilder<OP,?>>
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_REPEATS
-
Constructor Summary
Constructors Constructor Description While()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Conditional
getConditional()
int
getMaxRepeats()
Operation
getOperation()
Collection<Operation>
getOperations()
Should return aCollection
of all operations contained within theOperations
implementation.Map<String,String>
getOptions()
com.fasterxml.jackson.core.type.TypeReference<O>
getOutputTypeReference()
int
hashCode()
Boolean
isCondition()
void
setCondition(Boolean condition)
void
setConditional(Conditional conditional)
void
setMaxRepeats(int maxRepeats)
void
setOperation(Operation op)
void
setOptions(Map<String,String> options)
While<I,O>
shallowClone()
Operation implementations should ensure a ShallowClone method is implemented.String
toString()
void
updateOperations(Collection<Operation> operations)
Updates the operations using the provided collection.uk.gov.gchq.koryphe.ValidationResult
validate()
Validates an operation.-
Methods inherited from class uk.gov.gchq.gaffer.operation.io.GenericInput
getInput, setInput
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.Operation
_getNullOrOptions, addOption, containsOption, getOption, getOption, validateRequiredFieldPresent
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.Operations
flatten, getOperationsClass
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.io.Output
castToOutputType, getOutputClass, getOutputType
-
-
-
-
Field Detail
-
MAX_REPEATS
public static final int MAX_REPEATS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOutputTypeReference
public com.fasterxml.jackson.core.type.TypeReference<O> getOutputTypeReference()
- Specified by:
getOutputTypeReference
in interfaceOutput<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 interfaceOperation
- Returns:
- shallow clone
-
getOperations
public Collection<Operation> getOperations()
Description copied from interface:Operations
Should return aCollection
of all operations contained within theOperations
implementation. The collection of operations may be modified by Gaffer.- Specified by:
getOperations
in interfaceOperations<I>
- Returns:
- A
Collection
ofOperation
s.
-
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 interfaceOperations<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.
-
getOptions
public Map<String,String> getOptions()
- Specified by:
getOptions
in interfaceOperation
- 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 interfaceOperation
- 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()
-
getConditional
public Conditional getConditional()
-
getMaxRepeats
public int getMaxRepeats()
-
setMaxRepeats
public void setMaxRepeats(int maxRepeats)
-
isCondition
public Boolean isCondition()
-
setCondition
public void setCondition(Boolean condition)
-
-