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 aMinimizedPricerecord class. -
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.intReturns the value of thepricePerUnitrecord component.intquantity()Returns the value of thequantityrecord component.final StringtoString()Returns a string representation of this record class.inttotal()The total price.
-
Constructor Details
-
MinimizedPrice
public MinimizedPrice(int pricePerUnit, int quantity) Creates an instance of aMinimizedPricerecord class.- Parameters:
pricePerUnit- the value for thepricePerUnitrecord componentquantity- the value for thequantityrecord 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 thepricePerUnitrecord component.- Returns:
- the value of the
pricePerUnitrecord component
-
quantity
public int quantity()Returns the value of thequantityrecord component.- Returns:
- the value of the
quantityrecord component
-