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>
AWhileis anOperationwhich 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
Conditionalcan 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 thePredicatecontained 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 classWhile.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 intMAX_REPEATS
-
Constructor Summary
Constructors Constructor Description While()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)ConditionalgetConditional()intgetMaxRepeats()OperationgetOperation()Collection<Operation>getOperations()Should return aCollectionof all operations contained within theOperationsimplementation.Map<String,String>getOptions()com.fasterxml.jackson.core.type.TypeReference<O>getOutputTypeReference()inthashCode()BooleanisCondition()voidsetCondition(Boolean condition)voidsetConditional(Conditional conditional)voidsetMaxRepeats(int maxRepeats)voidsetOperation(Operation op)voidsetOptions(Map<String,String> options)While<I,O>shallowClone()Operation implementations should ensure a ShallowClone method is implemented.StringtoString()voidupdateOperations(Collection<Operation> operations)Updates the operations using the provided collection.uk.gov.gchq.koryphe.ValidationResultvalidate()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:
getOutputTypeReferencein interfaceOutput<I>
-
shallowClone
public While<I,O> shallowClone()
Description copied from interface:OperationOperation 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:
shallowClonein interfaceOperation- Returns:
- shallow clone
-
getOperations
public Collection<Operation> getOperations()
Description copied from interface:OperationsShould return aCollectionof all operations contained within theOperationsimplementation. The collection of operations may be modified by Gaffer.- Specified by:
getOperationsin interfaceOperations<I>- Returns:
- A
CollectionofOperations.
-
updateOperations
public void updateOperations(Collection<Operation> operations)
Description copied from interface:OperationsUpdates the operations using the provided collection. By default this will just clear the current operations collection and add all the new operations.- Specified by:
updateOperationsin interfaceOperations<I>- Parameters:
operations- the new operations.
-
validate
public uk.gov.gchq.koryphe.ValidationResult validate()
Description copied from interface:OperationValidates 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:
getOptionsin 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:
setOptionsin 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)
-
-