Record Class ParameterSchema

java.lang.Object
java.lang.Record
com.inductiveautomation.historian.common.model.options.ParameterSchema

public record ParameterSchema(List<ParameterSchema.ParameterField> fields, Class<? extends AggregateParams> recordType) extends Record
Describes the parameter contract of an AggregationType, for frontend rendering and for decoding the parameters of a parameterized aggregate.

The recordType ties the schema to a typed AggregateParams record: validateRecord(AggregateParams) checks a runtime instance against it, and fromMap(Map) rebuilds a typed record from a JSON-decoded map. The sealed ParameterSchema.ParameterField permits (ParameterSchema.ScalarField, ParameterSchema.EnumField) make frontend rendering switch-exhaustive.

  • Field Details

  • Constructor Details

    • ParameterSchema

      public ParameterSchema(List<ParameterSchema.ParameterField> fields, Class<? extends AggregateParams> recordType)
      Creates an instance of a ParameterSchema record class.
      Parameters:
      fields - the value for the fields record component
      recordType - the value for the recordType record component
  • Method Details

    • builder

      public static ParameterSchema.Builder builder(Class<? extends AggregateParams> recordType)
    • validateRecord

      public void validateRecord(AggregateParams params)
      Checks that a runtime AggregateParams matches this schema's record type.
      Parameters:
      params - the parameters to check.
      Throws:
      IllegalArgumentException - if params is not of the record type.
    • fromMap

      public AggregateParams fromMap(Map<String,Object> values)
      Builds typed parameters from a wire-decoded JSON map.
      Parameters:
      values - the decoded parameter values by field name.
      Returns:
      the typed parameters.
    • fromMapWithDefaults

      public AggregateParams fromMapWithDefaults(Map<String,Object> values)
      Builds typed parameters from a wire-decoded JSON map, taking each field's declared ParameterSchema.ParameterField.defaultValue() when the map lacks its key.
      Parameters:
      values - the decoded parameter values by field name; may omit fields.
      Returns:
      the typed parameters.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fields

      Returns the value of the fields record component.
      Returns:
      the value of the fields record component
    • recordType

      public Class<? extends AggregateParams> recordType()
      Returns the value of the recordType record component.
      Returns:
      the value of the recordType record component