java.lang.Object
java.lang.Record
dev.hloth.zgztransport.Product
- Record Components:
sector- the sector holding it,3or4metadata- block 12 or 16, which describes the productsubscription- block 13 or 17, which holds its validity
public record Product(int sector, SubscriptionMetadata metadata, Subscription subscription)
extends Record
One subscription product of a personal card, which lives in a sector of its
own.
-
Constructor Summary
ConstructorsConstructorDescriptionProduct(int sector, SubscriptionMetadata metadata, Subscription subscription) Checks that the sector is one a product lives in and that the blocks are present. -
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.metadata()Returns the value of themetadatarecord component.intsector()Returns the value of thesectorrecord component.Returns the value of thesubscriptionrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Product
Checks that the sector is one a product lives in and that the blocks are present.- Throws:
IllegalArgumentException- if the sector is outside3to4NullPointerException- if a field is null
-
-
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 '=='. -
sector
public int sector()Returns the value of thesectorrecord component.- Returns:
- the value of the
sectorrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-
subscription
Returns the value of thesubscriptionrecord component.- Returns:
- the value of the
subscriptionrecord component
-