Class DefaultRecordEncodingDelegate.Builder

java.lang.Object
com.inductiveautomation.ignition.gateway.config.migration.DefaultRecordEncodingDelegate.Builder
Enclosing class:
DefaultRecordEncodingDelegate

public static class DefaultRecordEncodingDelegate.Builder extends Object
  • Method Details

    • includeField

      public DefaultRecordEncodingDelegate.Builder includeField(SFieldMeta... field)
      If this is invoked, only fields specified will be included, all others will be ignored by default.
    • ignoreField

      public DefaultRecordEncodingDelegate.Builder ignoreField(SFieldMeta... field)
      Specifies a field (or fields) to be ignored when encoding a record as a resource. Note that ID fields, Name fields, Description fields, and LongFields that are used by ReferenceFields will be automatically ignored
    • withCustomFieldName

      public DefaultRecordEncodingDelegate.Builder withCustomFieldName(SFieldMeta field, String customName)
      Specifies a custom json name for a field, instead of the standard strategy of trying to convert the field name to camel case by changing the first letter to lowercase.
    • withFieldEncoder

      public DefaultRecordEncodingDelegate.Builder withFieldEncoder(SFieldMeta field, BiConsumer<PersistentRecord,com.inductiveautomation.ignition.common.gson.JsonObject> encoder)
      Specifies a custom encoder for a field. This is useful for fields that need to be encoded in a special way.
      Parameters:
      field - the field to encode
      encoder - receives the json object of the configuration, expected to modify it and add the field's custom encoding
    • withFieldEncoder

      public DefaultRecordEncodingDelegate.Builder withFieldEncoder(SFieldMeta field, String customName, Function<PersistentRecord,Optional<com.inductiveautomation.ignition.common.gson.JsonElement>> encoder)
      Specifies a custom encoder for a field. This is useful for fields that need to be encoded in a special way.
      Parameters:
      field - the field to encode
      customName - a custom name for the new setting
      encoder - receives the old record, expected to return a custom encoding for the new settings object
    • withReferenceNameLookupFunction

      public DefaultRecordEncodingDelegate.Builder withReferenceNameLookupFunction(Function<SRecordInstance,@Nullable String> getReferenceName)
      Specifies a custom lookup function to use when encoding a reference field.

      This function should return the value of the "Name" field in the provided Record.

      This function only needs to be customized when the field name is something other than "Name".

      Parameters:
      getReferenceName - Function that returns the value of the "Name" field in a record.
      Returns:
      this Builder.
    • build