Record Class ParameterConstraint
java.lang.Object
java.lang.Record
zeroecho.core.ParameterConstraint
- Record Components:
name- parameter namekind- value kindrequired- whether omission without a default is rejecteddefaultValue- optional defaultallowedValues- ordered allowed values, or an empty listminimum- optional inclusive integer lower boundmaximum- optional inclusive integer upper boundstep- positive integer modulusremainder- required nonnegative remainder smaller than step
public record ParameterConstraint(String name, ParameterConstraint.ValueKind kind, boolean required, Object defaultValue, List<?> allowedValues, Long minimum, Long maximum, long step, long remainder)
extends Record
Immutable machine-readable validation for one template argument. Numeric bounds
are inclusive; an integer must satisfy
floorMod(value, step) == remainder.
Empty choices mean unrestricted values of the declared kind. Null defaults mean
no default. Only immutable scalar values are accepted as defaults and choices.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMachine-readable scalar kind; legacy types retain their presentation type. -
Constructor Summary
ConstructorsConstructorDescriptionParameterConstraint(String name, ParameterConstraint.ValueKind kind, boolean required, Object defaultValue, List<?> allowedValues, Long minimum, Long maximum, long step, long remainder) Validates and snapshots the constraint. -
Method Summary
Modifier and TypeMethodDescriptionList<?> Returns the value of theallowedValuesrecord component.Returns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.maximum()Returns the value of themaximumrecord component.minimum()Returns the value of theminimumrecord component.name()Returns the value of thenamerecord component.longReturns the value of theremainderrecord component.booleanrequired()Returns the value of therequiredrecord component.longstep()Returns the value of thesteprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ParameterConstraint
public ParameterConstraint(String name, ParameterConstraint.ValueKind kind, boolean required, Object defaultValue, List<?> allowedValues, Long minimum, Long maximum, long step, long remainder) Validates and snapshots the constraint.- Throws:
IllegalArgumentException- if the definition is inconsistentNullPointerException- if name, kind or choices is null
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
kind
-
required
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
allowedValues
Returns the value of theallowedValuesrecord component.- Returns:
- the value of the
allowedValuesrecord component
-
minimum
-
maximum
-
step
-
remainder
-