Class BasicFieldTransformer.SingleValueOperation
java.lang.Object
com.northconcepts.datapipeline.transform.BasicFieldTransformer.Operation
com.northconcepts.datapipeline.transform.BasicFieldTransformer.SingleValueOperation
- All Implemented Interfaces:
INodeVisitor
- Direct Known Subclasses:
BasicFieldTransformer.StringOperation
- Enclosing class:
BasicFieldTransformer
public abstract static class BasicFieldTransformer.SingleValueOperation
extends BasicFieldTransformer.Operation
implements INodeVisitor
An
BasicFieldTransformer.Operation applied to each single value in a field, including array elements and values in nested records.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSingleValueOperation(String name, FieldType returnType) Creates an operation that skips null values, only retyping them as nulls ofreturnType.SingleValueOperation(String name, FieldType returnType, boolean applyToNulls) Creates an operation that storesnullresults as nulls ofreturnType; null values reachapplyImplonly ifapplyToNullsis true (otherwise they are just retyped). -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this operation's details to an exception raised while it runs; returns the same exception.protected final voidApplies this operation to the field, updating its value in place.protected abstract ObjectapplyImpl(SingleValue input) Returns the replacement forinput; returninputitself to leave it unchanged ornullto store a null ofreturnType.protected voidapplyToArrayValue(ArrayValue array, int index, SingleValue input) AppliesapplyImplto the array element at the 0-basedindexand stores the result in the array.protected voidapplyToFieldValue(Field field, SingleValue input) AppliesapplyImplto a field's single value and stores the result in the field.protected voidapplyToNullArray(ArrayValue array) final voidendArray(ArrayValue array) Called after all of the array's elements have been visited.final voidendArrayValue(ArrayValue array, int index, ValueNode<?> value) Called after the element at the given 0-based index has been visited.final voidCalled last for a field, afterINodeVisitor.endFieldValue(Field, ValueNode).final voidendFieldValue(Field field, ValueNode<?> value) Called after the field's value node has been visited.final voidCalled after all of the record's fields have been visited.final voidsingleValue(SingleValue value) Called for each single (leaf) value; it has no matching end callback.final voidstartArray(ArrayValue array) Called before the array's elements are visited.final voidstartArrayValue(ArrayValue array, int index, ValueNode<?> value) Called before the element at the given 0-based index is visited.final voidstartField(Field field) Called when a field is reached, beforeINodeVisitor.startFieldValue(Field, ValueNode).final voidstartFieldValue(Field field, ValueNode<?> value) Called before the field's value node is visited.final voidstartRecord(Record record) Called before the record's fields are visited.Methods inherited from class com.northconcepts.datapipeline.transform.BasicFieldTransformer.Operation
toString
-
Field Details
-
returnType
-
applyToNulls
protected boolean applyToNulls
-
-
Constructor Details
-
SingleValueOperation
Creates an operation that storesnullresults as nulls ofreturnType; null values reachapplyImplonly ifapplyToNullsis true (otherwise they are just retyped). -
SingleValueOperation
Creates an operation that skips null values, only retyping them as nulls ofreturnType.
-
-
Method Details
-
addExceptionProperties
Description copied from class:BasicFieldTransformer.OperationAdds this operation's details to an exception raised while it runs; returns the same exception.- Overrides:
addExceptionPropertiesin classBasicFieldTransformer.Operation
-
apply
Description copied from class:BasicFieldTransformer.OperationApplies this operation to the field, updating its value in place.- Specified by:
applyin classBasicFieldTransformer.Operation- Throws:
Throwable
-
applyToNullArray
-
applyToFieldValue
AppliesapplyImplto a field's single value and stores the result in the field.- Throws:
Throwable
-
applyToArrayValue
AppliesapplyImplto the array element at the 0-basedindexand stores the result in the array.- Throws:
Throwable
-
applyImpl
Returns the replacement forinput; returninputitself to leave it unchanged ornullto store a null ofreturnType.- Throws:
Throwable
-
startArray
Description copied from interface:INodeVisitorCalled before the array's elements are visited.- Specified by:
startArrayin interfaceINodeVisitor- Throws:
Throwable
-
endArray
Description copied from interface:INodeVisitorCalled after all of the array's elements have been visited.- Specified by:
endArrayin interfaceINodeVisitor- Throws:
Throwable
-
startFieldValue
Description copied from interface:INodeVisitorCalled before the field's value node is visited.- Specified by:
startFieldValuein interfaceINodeVisitor- Throws:
Throwable
-
endFieldValue
Description copied from interface:INodeVisitorCalled after the field's value node has been visited.- Specified by:
endFieldValuein interfaceINodeVisitor- Throws:
Throwable
-
startArrayValue
Description copied from interface:INodeVisitorCalled before the element at the given 0-based index is visited.- Specified by:
startArrayValuein interfaceINodeVisitor- Throws:
Throwable
-
endArrayValue
Description copied from interface:INodeVisitorCalled after the element at the given 0-based index has been visited.- Specified by:
endArrayValuein interfaceINodeVisitor- Throws:
Throwable
-
startRecord
Description copied from interface:INodeVisitorCalled before the record's fields are visited.- Specified by:
startRecordin interfaceINodeVisitor- Throws:
Throwable
-
endRecord
Description copied from interface:INodeVisitorCalled after all of the record's fields have been visited.- Specified by:
endRecordin interfaceINodeVisitor- Throws:
Throwable
-
startField
Description copied from interface:INodeVisitorCalled when a field is reached, beforeINodeVisitor.startFieldValue(Field, ValueNode).- Specified by:
startFieldin interfaceINodeVisitor- Throws:
Throwable
-
endField
Description copied from interface:INodeVisitorCalled last for a field, afterINodeVisitor.endFieldValue(Field, ValueNode).- Specified by:
endFieldin interfaceINodeVisitor- Throws:
Throwable
-
singleValue
Description copied from interface:INodeVisitorCalled for each single (leaf) value; it has no matching end callback.- Specified by:
singleValuein interfaceINodeVisitor- Throws:
Throwable
-