Package de.chojo.universalis.entities
Record Class MinimizedPrice
java.lang.Object
java.lang.Record
de.chojo.universalis.entities.MinimizedPrice
- Record Components:
pricePerUnit
- unit pricequantity
- quantity
Price of a listing
-
Constructor Summary
ConstructorsConstructorDescriptionMinimizedPrice
(int pricePerUnit, int quantity) Creates an instance of aMinimizedPrice
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()
The total price.
-
Constructor Details
-
MinimizedPrice
public MinimizedPrice(int pricePerUnit, int quantity) Creates an instance of aMinimizedPrice
record class.- Parameters:
pricePerUnit
- the value for thepricePerUnit
record componentquantity
- the value for thequantity
record component
-
-
Method Details
-
total
public int total()The total price. Manually calculated.- Returns:
- total price
-
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
-