Class CopyField

java.lang.Object
com.northconcepts.datapipeline.transform.Transformer
com.northconcepts.datapipeline.transform.CopyField

public class CopyField extends Transformer
Creates a duplicate field with the specified target name. See FieldPath for supported field name expressions.
  • Constructor Details

    • CopyField

      public CopyField(String sourceFieldName, String targetFieldName)
      Always overwrites the target field.
    • CopyField

      public CopyField(String sourceFieldName, String targetFieldName, boolean overwrite)
      Creates a transformer that copies the source field's value into the target field (created if missing) unless the target already exists and overwrite is false.
  • Method Details

    • getSourceFieldName

      public String getSourceFieldName()
    • getTargetFieldName

      public String getTargetFieldName()
    • getOverwrite

      public boolean getOverwrite()
    • transform

      public boolean transform(Record record) throws Throwable
      Description copied from class: Transformer
      Applies this transformer to a record on its way through a TransformingReader or TransformingWriter.

      Contract for subclasses (see also docs/authoring/Transformer.md):

      • Mutate record in place as needed.
      • Return true to keep the record in the pipeline.
      • Return false to 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:
      transform in class Transformer
      Throws:
      Throwable
    • toString

      public String toString()
      Overrides:
      toString in class Object