Package de.chojo.universalis.entities
Record Class Price
java.lang.Object
java.lang.Record
de.chojo.universalis.entities.Price
- Record Components:
pricePerUnit
- unit pricequantity
- quantitytotal
- total
Price of a listing
-
Constructor Summary
ConstructorsConstructorDescriptionPrice
(int pricePerUnit, int quantity, int total) Creates an instance of aPrice
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of thepricePerUnit
record component.int
quantity()
Returns the value of thequantity
record component.final String
toString()
Returns a string representation of this record class.int
total()
Returns the value of thetotal
record component.
-
Constructor Details
-
Price
public Price(int pricePerUnit, int quantity, int total) Creates an instance of aPrice
record class.- Parameters:
pricePerUnit
- the value for thepricePerUnit
record componentquantity
- the value for thequantity
record componenttotal
- the value for thetotal
record component
-
-
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 with '=='. -
pricePerUnit
public int pricePerUnit()Returns the value of thepricePerUnit
record component.- Returns:
- the value of the
pricePerUnit
record component
-
quantity
public int quantity()Returns the value of thequantity
record component.- Returns:
- the value of the
quantity
record component
-
total
public int total()Returns the value of thetotal
record component.- Returns:
- the value of the
total
record component
-