Interface FieldMergeFunction

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface FieldMergeFunction
Represents a function that allows you to define a merge field value based on a given field context.

Code Sample

 // Survive based on the “source’s last update timestamp”
 public class SourceLastUpdateMergeFunctionExecutor implements FieldMergeFunction {
      public MergedFieldValue apply(FieldMergeContext fieldMergeContext) {
          List matchRecords = fieldMergeContext.getRecords();
          Adaptation latestRecord = fieldMergeContext.getGoldenRecord();
          Date latestDateTime = latestRecord
                                .getDate(SupplierPaths._Root_Supplier._SrcSystemAudit_SrcLastUpdatedDate);
          for (Adaptation matchRecord : matchRecords)
          {
              Date timestamp = matchRecord
                     .getDate(SupplierPaths._Root_Supplier._SrcSystemAudit_SrcLastUpdatedDate);
              if (timestamp == null)
              {
                  continue;
              }
              if (latestDateTime == null || latestDateTime.compareTo(timestamp) < 0)
              {
                  latestDateTime = timestamp;
                  latestRecord = matchRecord;
              }
          }
          return fieldMergeContext.createMergedValue(latestRecord.getOccurrencePrimaryKey());
      }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(FieldMergeContext fieldMergeContext)
    Applies this function to the given field merge context.
  • Method Details

    • apply

      MergedFieldValue apply(FieldMergeContext fieldMergeContext)

      Applies this function to the given field merge context.

      This method is invoked every time when deciding on a survivor field.

      Returns:
      MergedFieldValue Returns the merged value for a field in a golden record.