Package com.tnsai.norms
Record Class NormViolation
java.lang.Object
java.lang.Record
com.tnsai.norms.NormViolation
public record NormViolation(NormEntry norm, String action, String reason, Instant timestamp)
extends Record
Represents a violation of a norm.
-
Constructor Summary
ConstructorsConstructorDescriptionNormViolation(NormEntry norm, String action, String reason) NormViolation(NormEntry norm, String action, String reason, Instant timestamp) Creates an instance of aNormViolationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.norm()Returns the value of thenormrecord component.reason()Returns the value of thereasonrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NormViolation
Creates an instance of aNormViolationrecord class.- Parameters:
norm- the value for thenormrecord componentaction- the value for theactionrecord componentreason- the value for thereasonrecord componenttimestamp- the value for thetimestamprecord component
-
NormViolation
-
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
norm
Returns the value of thenormrecord component.- Returns:
- the value of the
normrecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-
reason
Returns the value of thereasonrecord component.- Returns:
- the value of the
reasonrecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-