Record Class CalculatedPrice
java.lang.Object
java.lang.Record
de.codebarista.shopware.model.core.CalculatedPrice
public record CalculatedPrice(BigDecimal quantity, BigDecimal totalPrice, BigDecimal unitPrice, List<CalculatedTax> calculatedTaxes)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionCalculatedPrice(BigDecimal quantity, BigDecimal totalPrice, BigDecimal unitPrice, List<CalculatedTax> calculatedTaxes) Creates an instance of aCalculatedPricerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecalculatedTaxesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.netUnitPrice(ShopwareTaxStatus taxStatus) quantity()Returns the value of thequantityrecord component.final StringtoString()Returns a string representation of this record class.totalNetPrice(ShopwareTaxStatus taxStatus) Returns the value of thetotalPricerecord component.Returns the value of theunitPricerecord component.
-
Constructor Details
-
CalculatedPrice
public CalculatedPrice(BigDecimal quantity, BigDecimal totalPrice, BigDecimal unitPrice, List<CalculatedTax> calculatedTaxes) Creates an instance of aCalculatedPricerecord class.- Parameters:
quantity- the value for thequantityrecord componenttotalPrice- the value for thetotalPricerecord componentunitPrice- the value for theunitPricerecord componentcalculatedTaxes- the value for thecalculatedTaxesrecord component
-
-
Method Details
-
singleTaxRate
- Returns:
- the calculated tax, if only one calculated tax is present;
null, if no calculated tax is present.
Throws an exception, if more than one calculated tax is present.
-
netUnitPrice
-
totalNetPrice
-
totalTaxAmount
-
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). -
quantity
Returns the value of thequantityrecord component.- Returns:
- the value of the
quantityrecord component
-
totalPrice
Returns the value of thetotalPricerecord component.- Returns:
- the value of the
totalPricerecord component
-
unitPrice
Returns the value of theunitPricerecord component.- Returns:
- the value of the
unitPricerecord component
-
calculatedTaxes
Returns the value of thecalculatedTaxesrecord component.- Returns:
- the value of the
calculatedTaxesrecord component
-