Record Class Subtotal
java.lang.Object
java.lang.Record
net.tangly.erp.invoices.domain.Subtotal
- All Implemented Interfaces:
net.tangly.core.HasText
,InvoiceLine
public record Subtotal(int position, String text, @NotNull List<InvoiceLine> items)
extends Record
implements InvoiceLine
The subtotal defines the sum for a set of positions in the invoice. A subtotal groups a set of related positions, such as belonging to the same accounting
position or project booking, or to the same amount of VAT percentage for mixed VAT invoices.
-
Field Summary
Fields inherited from interface net.tangly.core.HasText
TEXT
-
Constructor Summary
ConstructorsConstructorDescriptionSubtotal
(int position, String text, @NotNull List<InvoiceLine> items) Creates an instance of aSubtotal
record class. -
Method Summary
Modifier and TypeMethodDescriptionamount()
Return the amount associated with the line.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
isItem()
Return true if the line contains items.@NotNull List
<InvoiceLine> items()
Returns the value of theitems
record component.int
position()
Returns the value of theposition
record component.Return the list of positions part of the subtotal aggregate.quantity()
Return the quantity of items associated with an invoice line.text()
Returns the value of thetext
record component.final String
toString()
Returns a string representation of this record class.Return the unit price of items associated with an invoice line.vat()
Return the VAT amount associated with the line.vatRate()
Return the VAT rate associated with the line.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.tangly.erp.invoices.domain.InvoiceLine
isAggregate
-
Constructor Details
-
Subtotal
Creates an instance of aSubtotal
record class.- Parameters:
position
- the value for theposition
record componenttext
- the value for thetext
record componentitems
- the value for theitems
record component
-
-
Method Details
-
amount
Description copied from interface:InvoiceLine
Return the amount associated with the line.- Specified by:
amount
in interfaceInvoiceLine
- Returns:
- the amount of the line
-
vat
Description copied from interface:InvoiceLine
Return the VAT amount associated with the line.- Specified by:
vat
in interfaceInvoiceLine
- Returns:
- the VAT amount of the line
-
quantity
Description copied from interface:InvoiceLine
Return the quantity of items associated with an invoice line.- Specified by:
quantity
in interfaceInvoiceLine
- Returns:
- the quantity of items if defined otherwise zero
-
unitPrice
Description copied from interface:InvoiceLine
Return the unit price of items associated with an invoice line.- Specified by:
unitPrice
in interfaceInvoiceLine
- Returns:
- the unit price of the items for the line
-
vatRate
Description copied from interface:InvoiceLine
Return the VAT rate associated with the line.- Specified by:
vatRate
in interfaceInvoiceLine
- Returns:
- the VAT rate of the line
-
isItem
public boolean isItem()Description copied from interface:InvoiceLine
Return true if the line contains items.- Specified by:
isItem
in interfaceInvoiceLine
- Returns:
- flag indicating the line contains items
-
positions
Return the list of positions part of the subtotal aggregate.- Returns:
- positions associated with the subtotal
-
toString
-
hashCode
-
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 thecompare
method from their corresponding wrapper classes. -
position
public int position()Returns the value of theposition
record component.- Specified by:
position
in interfaceInvoiceLine
- Returns:
- the value of the
position
record component
-
text
Returns the value of thetext
record component.- Specified by:
text
in interfacenet.tangly.core.HasText
- Specified by:
text
in interfaceInvoiceLine
- Returns:
- the value of the
text
record component
-
items
Returns the value of theitems
record component.- Returns:
- the value of the
items
record component
-