Class SetCalculatedField

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

public class SetCalculatedField extends Transformer
See FieldPath for supported field name expressions.
  • Constructor Details

    • SetCalculatedField

      public SetCalculatedField(String name, String expression, boolean overwrite)
      Creates a transformer that sets the field to the value of expression for each record unless the field exists and overwrite is false.
    • SetCalculatedField

      public SetCalculatedField(FieldPath name, String expression, boolean overwrite)
      Creates a transformer that sets the field to the value of expression for each record unless the field exists and overwrite is false.
    • SetCalculatedField

      public SetCalculatedField(String name, String expression, FieldDeclarations fieldDeclarations, boolean overwrite)
      Creates a transformer that sets the field to the value of expression unless the field exists and overwrite is false; fieldDeclarations sets the Java types the expression assumes for the declared fields.
    • SetCalculatedField

      public SetCalculatedField(FieldPath name, String expression, FieldDeclarations fieldDeclarations, boolean overwrite)
      Creates a transformer that sets the field to the value of expression unless the field exists and overwrite is false; fieldDeclarations sets the Java types the expression assumes for the declared fields.
    • SetCalculatedField

      public SetCalculatedField(String name, String expression)
      Creates a transformer that sets the field to the value of expression for each record, overwriting any existing value.
    • SetCalculatedField

      public SetCalculatedField(FieldPath name, String expression)
      Creates a transformer that sets the field to the value of expression for each record, overwriting any existing value.
    • SetCalculatedField

      public SetCalculatedField(String name, String expression, FieldDeclarations fieldDeclarations)
      Creates a transformer that sets the field to the value of expression, overwriting any existing value; fieldDeclarations sets the Java types the expression assumes for the declared fields.
    • SetCalculatedField

      public SetCalculatedField(FieldPath name, String expression, FieldDeclarations fieldDeclarations)
      Creates a transformer that sets the field to the value of expression, overwriting any existing value; fieldDeclarations sets the Java types the expression assumes for the declared fields.
  • Method Details

    • getName

      public String getName()
    • getExpression

      public String getExpression()
    • 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