public interface Accountancy<T extends AccountancyEntry>
Accountancy
interface is implemented by classes offering a basic accounting service. Generally, an
Accountancy
aggregates objects of the type AccountancyEntry
and subclasses thereof. Additionally, an
Accountancy
offers methods for querying of entries and financial statistics.Modifier and Type | Method and Description |
---|---|
T |
add(T accountancyEntry)
Adds a new
AccountancyEntry to this Accountancy . |
Iterable<T> |
find(LocalDateTime from,
LocalDateTime to)
Returns all
AccountancyEntry s in between the dates from and to of the specified class type
clazz and all sub-types, including from and to. |
Map<Interval,Iterable<T>> |
find(LocalDateTime from,
LocalDateTime to,
Duration duration)
Returns all
AccountancyEntry s of type clazz and all sub-types, which have their date within
(including) from and to . |
Iterable<T> |
findAll()
Returns all
AccountancyEntry s of the specified type clazz and all sub-types, previously added to
the accountancy. |
Optional<T> |
get(AccountancyEntryIdentifier accountancyEntryIdentifier)
Returns the
AccountancyEntry of type clazz and all sub-types, identified by
AccountancyEntryIdentifier . |
Map<Interval,org.joda.money.Money> |
salesVolume(LocalDateTime from,
LocalDateTime to,
Duration duration)
Returns the sum of the field
amount of all AccountancyEntry s of type clazz and its
sub-types, which have their date within (including) from and to . |
T add(T accountancyEntry)
AccountancyEntry
to this Accountancy
.accountancyEntry
- entry to be added to the accountancyIterable<T> findAll()
AccountancyEntry
s of the specified type clazz
and all sub-types, previously added to
the accountancy. If no entries of the specified type exist, an empty Iterable
is returned.T
- common super type of all entries returned.clazz
- Class object corresponding to the type of the entries to be returned, has to implement
AccountancyEntry
Iterable
containing all entries of type clazzOptional<T> get(AccountancyEntryIdentifier accountancyEntryIdentifier)
AccountancyEntry
of type clazz
and all sub-types, identified by
AccountancyEntryIdentifier
. null is returned, if no entry with the given identifier exists.E
- common super type of all entries returned.clazz
- type of the entry to be returned; has to implement AccountancyEntry
accountancyEntryIdentifier
- the AccountancyEntryIdentifier
of the entry to be returnedAccountancyEntry
or sub type thereof of type clazz
which has the identifier
AccountancyEntryIdentifier
Iterable<T> find(LocalDateTime from, LocalDateTime to)
AccountancyEntry
s in between the dates from
and to
of the specified class type
clazz
and all sub-types, including from and to. So every entry with an time stamp <= to
and >=
from
is returned. If no entries within the specified time span exist, or no entries of the specified class
type exist, an empty Iterable is returned.T
- common super type of all entries returnedfrom
- LocalDateTime
denoting the start of the requested time periodto
- LocalDateTime
denoting the end of the requested time periodclazz
- class type of the requested entries, has to implement AccountancyEntry
Iterable
containing all entries between from and to of type EMap<Interval,Iterable<T>> find(LocalDateTime from, LocalDateTime to, Duration duration)
AccountancyEntry
s of type clazz
and all sub-types, which have their date
within
(including) from
and to
. from
and to
is divided into parts of period
length. According to their
respective date, entries are sorted in exactly one of the time intervals. The last time interval may be shorter
than period
.Interval
objects as its key, and an Iterable
as value. The
Iterable
contains all entries of the specific type with its date in the interval specified by the key.Iterable
.T
- common super type of all entries returnedclazz
- class type of the requested entries; has to implement AccountancyEntry
from
- all returned entries will have a time stamp after from
to
- all returned entries will have a time stamp before to
duration
- length of the time intervals, the period between from
and to
is dividedperiod
length between from
and to
as keys, and as value an
Iterable
containing all entries within the key- Interval
Map<Interval,org.joda.money.Money> salesVolume(LocalDateTime from, LocalDateTime to, Duration duration)
amount
of all AccountancyEntry
s of type clazz
and its
sub-types, which have their date
within (including) from
and to
. from
and to
is divided into parts of period
length. According to their
time stamp, entries are sorted in exactly one of the time intervals. The last time interval may be shorter than
period
.Interval
objects as its key, and an Money
as value. The Money
object's value is equal to the sum of all entries' amount
-field, with a date within the key-
Interval
. If within an interval no entries of the specified type exist, a Money
object with a value
of zero is added as value for that interval.T
- common super type of all entries returned.from
- all returned entries will have a time stamp after from
.to
- all returned entries will have a time stamp before to
.duration
- length of the time intervals, the period between from
and to
is divided.Map
, with intervals of period
length between from
and to
as keys, and as
value a Money
object, equal to the sum of the amount fields of all entries within the key-
Interval
.Copyright © 2014 Pivotal Software, Inc.. All rights reserved.