Class RemoveDuplicateFields
java.lang.Object
com.northconcepts.datapipeline.transform.Transformer
com.northconcepts.datapipeline.transform.RemoveDuplicateFields
Removes or collapses multiple fields with the same name in each record. This transformation works with simple
field names only and not field paths (
FieldPath).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumBuilt-in policies that keep all duplicates, keep only the first or last, merge their values into an array in the first field, or rename the later ones with a numeric suffix.static interfaceStrategy for resolving fields that share a name in a record, used byRemoveDuplicateFields.static classAn alternative toRemoveDuplicateFields.DuplicateFieldsPolicy.RENAMEthat uses a configurable separator between the original field name and the numeric suffix, preventing ambiguous names like20101when the field name itself ends in digits (e.g. -
Constructor Summary
ConstructorsConstructorDescriptionRemoveDuplicateFields(RemoveDuplicateFields.IDuplicateFieldsPolicy duplicateFieldsPolicy, String... fieldNames) Creates a transformer that applies the policy to fields sharing one of the given names, or any name if none are given.RemoveDuplicateFields(RemoveDuplicateFields.IDuplicateFieldsPolicy duplicateFieldsPolicy, Set<String> fieldNames) Creates a transformer that applies the policy to fields sharing one of the given names, or any name if the set is null or empty. -
Method Summary
Methods inherited from class com.northconcepts.datapipeline.transform.Transformer
addExceptionProperties, close, geEndpoint, getEndpoint, getReader, getWriter, of, open, setWriter
-
Constructor Details
-
RemoveDuplicateFields
public RemoveDuplicateFields(RemoveDuplicateFields.IDuplicateFieldsPolicy duplicateFieldsPolicy, Set<String> fieldNames) Creates a transformer that applies the policy to fields sharing one of the given names, or any name if the set is null or empty. -
RemoveDuplicateFields
public RemoveDuplicateFields(RemoveDuplicateFields.IDuplicateFieldsPolicy duplicateFieldsPolicy, String... fieldNames) Creates a transformer that applies the policy to fields sharing one of the given names, or any name if none are given.
-
-
Method Details
-
getFields
Returns the field names checked for duplicates; null or empty means all names. -
transform
Description copied from class:TransformerApplies this transformer to a record on its way through aTransformingReaderorTransformingWriter.Contract for subclasses (see also
docs/authoring/Transformer.md):- Mutate
recordin place as needed. - Return
trueto keep the record in the pipeline. - Return
falseto drop the record (the host routes it to a discard writer if one is configured, otherwise it disappears). - Throw to fail (or route to a discard writer, depending on host configuration).
- Do not call
incrementRecordCount()on the host endpoint; the host handles it.
- Specified by:
transformin classTransformer- Throws:
Throwable
- Mutate
-
toString
-