Interface Accountancy
An application service to manage
AccountancyEntrys and to create basic financial statistics.- Author:
- Hannes Weisbach, Oliver Drotbohm, Martin Morgenstern
-
Method Summary
Modifier and TypeMethodDescription<T extends AccountancyEntry>
Tadd(T entry) Adds a newAccountancyEntryto thisAccountancy.<T extends AccountancyEntry>
Streamable<T>Returns allAccountancyEntrys of the given type for the givenInterval.find(Interval interval, TemporalAmount duration) Returns allAccountancyEntrys within the given interval, grouped by sub-intervals of the given duration.<T extends AccountancyEntry>
Map<Interval,Streamable<T>> find(Interval interval, TemporalAmount duration, Class<T> type) Returns allAccountancyEntrys of the given type within the given interval, grouped by sub-intervals of the given duration.findAll()Returns allAccountancyEntrys previously added to the accountancy.<T extends AccountancyEntry>
Streamable<T>Returns allAccountancyEntryinstances of the given types, and the given types only.get(AccountancyEntry.AccountancyEntryIdentifier identifier) Returns theAccountancyEntryidentified by the givenAccountancyEntry.AccountancyEntryIdentifier, if it exists.<T extends AccountancyEntry>
Optional<T>get(AccountancyEntry.AccountancyEntryIdentifier identifier, Class<T> type) Returns theAccountancyEntryidentified by the givenAccountancyEntry.AccountancyEntryIdentifierof the given type, if it exists.salesVolume(Interval interval, TemporalAmount duration) Computes the sales volume, i.e., the sum ofAccountancyEntry.getValue(), for allAccountancyEntrys within the given interval, grouped by sub-intervals of the given duration.
-
Method Details
-
add
Adds a newAccountancyEntryto thisAccountancy. TheAccountancyEntry's date will be set to the value returned byBusinessTime.getTime()in case it is not set already.- Parameters:
entry- entry to be added to the accountancy, must not be null.- Returns:
- the added
AccountancyEntry.
-
findAll
Streamable<AccountancyEntry> findAll()Returns allAccountancyEntrys previously added to the accountancy.- Returns:
- a
Streamablecontaining all entries, or an emptyStreamable.
-
findAll
Returns allAccountancyEntryinstances of the given types, and the given types only. This means the asking for intermediate types in an inheritance hierarchy is not sufficient. All leaf types of the hierarchy would have to be passed in.- Type Parameters:
T- the concrete subtype ofAccountancyEntry.- Parameters:
type- must not be null.- Returns:
- will never be null.
- Since:
- 9.0
-
get
Returns theAccountancyEntryidentified by the givenAccountancyEntry.AccountancyEntryIdentifier, if it exists.- Parameters:
identifier- theAccountancyEntry.AccountancyEntryIdentifierof the entry to be returned, must not be null.- Returns:
- an
Optionalwith a matchingAccountancyEntry, or an emptyOptionalif no match was found.
-
get
<T extends AccountancyEntry> Optional<T> get(AccountancyEntry.AccountancyEntryIdentifier identifier, Class<T> type) Returns theAccountancyEntryidentified by the givenAccountancyEntry.AccountancyEntryIdentifierof the given type, if it exists.- Parameters:
identifier- theAccountancyEntry.AccountancyEntryIdentifierof the entry to be returned, must not be null.type- the concreteAccountancyEntrytype, must not be null.- Returns:
- an
Optionalwith a matchingAccountancyEntry, or an emptyOptionalif no match was found. - Since:
- 9.0
-
find
- Parameters:
interval- the interval within which we want to findAccountancyEntrys, must not be null.- Returns:
- a
Streamablecontaining all entries in the given interval, or an emptyStreamable.
-
find
Returns allAccountancyEntrys of the given type for the givenInterval.- Type Parameters:
T-- Parameters:
interval- must not be null.type- must not be null.- Returns:
- will never be null.
- Since:
- 9.0
-
find
Returns allAccountancyEntrys within the given interval, grouped by sub-intervals of the given duration. These sub-intervals are used as the keys of the returnedMap. Note that the last sub-interval may be shorter than the givenduration.- Parameters:
interval- the interval within which we want to findAccountancyEntrys, must not be null.duration- the duration of the sub-intervals, must not be null.- Returns:
- a
Mapcontaining aStreamablewith zero or moreAccountancyEntrys for each sub-interval.
-
find
<T extends AccountancyEntry> Map<Interval,Streamable<T>> find(Interval interval, TemporalAmount duration, Class<T> type) Returns allAccountancyEntrys of the given type within the given interval, grouped by sub-intervals of the given duration. These sub-intervals are used as the keys of the returnedMap. Note that the last sub-interval may be shorter than the givenduration.- Parameters:
interval- the interval within which we want to findAccountancyEntrys, must not be null.duration- the duration of the sub-intervals, must not be null.type-- Returns:
- a
Mapcontaining aStreamablewith zero or moreAccountancyEntrys for each sub-interval. - Since:
- 9.0
-
salesVolume
Computes the sales volume, i.e., the sum ofAccountancyEntry.getValue(), for allAccountancyEntrys within the given interval, grouped by sub-intervals of the given duration. If a sub-interval doesn't contain anAccountancyEntry, its sales volume is zero. Note that the last sub-interval may be shorter than the givenduration.- Parameters:
interval- the interval within which we want to findAccountancyEntrys, must not be null.duration- the duration of the sub-intervals that are used to group the summation, must not be null.- Returns:
- a
Mapcontaining the summed upMonetaryAmountfor each sub-interval.
-