Package com.onec.metadata
Record Class AttributeDescriptor.Constraints
java.lang.Object
java.lang.Record
com.onec.metadata.AttributeDescriptor.Constraints
- Enclosing class:
AttributeDescriptor
public static record AttributeDescriptor.Constraints(double min, double max, int minLength, String pattern, boolean email)
extends Record
Declarative validation bounds for an attribute, from
@Attribute. min/max
are NaN when unset; minLength is 0 when unset; pattern blank when
unset. The maximum string length is the descriptor's AttributeDescriptor.length().-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstraints(double min, double max, int minLength, String pattern, boolean email) Creates an instance of aConstraintsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanemail()Returns the value of theemailrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasMax()booleanhasMin()doublemax()Returns the value of themaxrecord component.doublemin()Returns the value of theminrecord component.intReturns the value of theminLengthrecord component.pattern()Returns the value of thepatternrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
-
-
Constructor Details
-
Constraints
Creates an instance of aConstraintsrecord class.- Parameters:
min- the value for theminrecord componentmax- the value for themaxrecord componentminLength- the value for theminLengthrecord componentpattern- the value for thepatternrecord componentemail- the value for theemailrecord component
-
-
Method Details
-
hasMin
public boolean hasMin() -
hasMax
public boolean hasMax() -
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 '=='. -
min
public double min()Returns the value of theminrecord component.- Returns:
- the value of the
minrecord component
-
max
public double max()Returns the value of themaxrecord component.- Returns:
- the value of the
maxrecord component
-
minLength
public int minLength()Returns the value of theminLengthrecord component.- Returns:
- the value of the
minLengthrecord component
-
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
email
public boolean email()Returns the value of theemailrecord component.- Returns:
- the value of the
emailrecord component
-