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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final recordstatic interfacestatic final recordstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParameterSchema(List<ParameterSchema.ParameterField> fields, Class<? extends AggregateParams> recordType) Creates an instance of aParameterSchemarecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ParameterSchema.Builderbuilder(Class<? extends AggregateParams> recordType) final booleanIndicates whether some other object is "equal to" this one.fields()Returns the value of thefieldsrecord component.Builds typed parameters from a wire-decoded JSON map.fromMapWithDefaults(Map<String, Object> values) Builds typed parameters from a wire-decoded JSON map, taking each field's declaredParameterSchema.ParameterField.defaultValue()when the map lacks its key.final inthashCode()Returns a hash code value for this object.Class<? extends AggregateParams> Returns the value of therecordTyperecord component.final StringtoString()Returns a string representation of this record class.voidvalidateRecord(AggregateParams params) Checks that a runtimeAggregateParamsmatches this schema's record type.
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ParameterSchema
public ParameterSchema(List<ParameterSchema.ParameterField> fields, Class<? extends AggregateParams> recordType) Creates an instance of aParameterSchemarecord class.- Parameters:
fields- the value for thefieldsrecord componentrecordType- the value for therecordTyperecord component
-
-
Method Details
-
builder
-
validateRecord
Checks that a runtimeAggregateParamsmatches this schema's record type.- Parameters:
params- the parameters to check.- Throws:
IllegalArgumentException- ifparamsis not of the record type.
-
fromMap
Builds typed parameters from a wire-decoded JSON map.- Parameters:
values- the decoded parameter values by field name.- Returns:
- the typed parameters.
-
fromMapWithDefaults
Builds typed parameters from a wire-decoded JSON map, taking each field's declaredParameterSchema.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
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-
recordType
Returns the value of therecordTyperecord component.- Returns:
- the value of the
recordTyperecord component
-