Package com.jsgalactic.axiom.validation
Record Class Constraint
java.lang.Object
java.lang.Record
com.jsgalactic.axiom.validation.Constraint
- Record Components:
kind- kind of checkmin- lower bound, inclusivemax- upper bound, inclusivepattern- the Java regular expression ofConstraint.Kind.PATTERN, otherwise nullvalues- the allowed values ofConstraint.Kind.ONE_OF, in declaration order
public record Constraint(Constraint.Kind kind, long min, long max, String pattern, List<String> values)
extends Record
What a built-in
Rule checks, as plain data for tools that document or mirror a rule set,
such as an OpenAPI generator. It carries the rule's parameters and never a value.
Which components apply depends on the kind; unused components are 0,
null and an empty list. For Constraint.Kind.LENGTH and Constraint.Kind.SIZE a max of Integer.MAX_VALUE means unbounded. For Constraint.Kind.RANGE (the min, max and
range rules) an unbounded end is Long.MIN_VALUE or Long.MAX_VALUE.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionConstraint(Constraint.Kind kind, long min, long max, String pattern, List<String> values) Creates a constraint. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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.longmax()Returns the value of themaxrecord component.longmin()Returns the value of theminrecord component.pattern()Returns the value of thepatternrecord component.final StringtoString()Returns a string representation of this record class.values()Returns the value of thevaluesrecord component.
-
Constructor Details
-
Constraint
Creates a constraint.- Parameters:
kind- kind of checkmin- lower boundmax- upper boundpattern- regular expression or nullvalues- allowed values
-
-
Method Details
-
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. -
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. -
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 '=='. -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
min
public long min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
public long max()Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
values
Returns the value of thevaluesrecord component.- Returns:
- the value of the
valuesrecord component
-