Record Class ConstraintRef
java.lang.Object
java.lang.Record
ai.timefold.solver.core.api.score.constraint.ConstraintRef
- Record Components:
packageName- The constraint package is the namespace of the constraint. When using aConstraintConfiguration, it is equal to theConstraintWeight.constraintPackage(). It is not recommended for the user to set this, or to read its value; instead, the user should use whatever the solver provided as default and not rely on this information at all. The entire concept of constraint package is likely to be removed in a future version of the solver.constraintName- The constraint name. It might not be unique, butconstraintId()is unique. When using aConstraintConfiguration, it is equal to theConstraintWeight.value().constraintId- Always derived frompackageNameandconstraintName.
- All Implemented Interfaces:
Comparable<ConstraintRef>
public record ConstraintRef(@NonNull String packageName, @NonNull String constraintName, String constraintId)
extends Record
implements Comparable<ConstraintRef>
Represents a unique identifier of a constraint.
Users should have no need to create instances of this record.
If necessary, use of(String, String) and not the record's constructors.
-
Constructor Summary
ConstructorsConstructorDescriptionConstraintRef(@NonNull String packageName, @NonNull String constraintName, String constraintId) Creates an instance of aConstraintRefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ConstraintRef other) static StringcomposeConstraintId(String packageName, String constraintName) Returns the value of theconstraintIdrecord component.@NonNull StringReturns the value of theconstraintNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ConstraintRef@NonNull StringReturns the value of thepackageNamerecord component.static ConstraintReftoString()Returns a string representation of this record class.
-
Constructor Details
-
ConstraintRef
public ConstraintRef(@NonNull String packageName, @NonNull String constraintName, String constraintId) Creates an instance of aConstraintRefrecord class.- Parameters:
packageName- the value for thepackageNamerecord componentconstraintName- the value for theconstraintNamerecord componentconstraintId- the value for theconstraintIdrecord component
-
-
Method Details
-
of
-
parseId
-
composeConstraintId
-
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. -
compareTo
- Specified by:
compareToin interfaceComparable<ConstraintRef>
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
packageName
Returns the value of thepackageNamerecord component.- Returns:
- the value of the
packageNamerecord component
-
constraintName
Returns the value of theconstraintNamerecord component.- Returns:
- the value of the
constraintNamerecord component
-
constraintId
Returns the value of theconstraintIdrecord component.- Returns:
- the value of the
constraintIdrecord component
-