public interface Accountancy
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 |
---|---|
void |
add(AccountancyEntry accountancyEntry)
Adds a new
AccountancyEntry to this Accountancy . |
<E extends AccountancyEntry> |
find(java.lang.Class<E> clazz)
Returns all
AccountancyEntry s of the specified type
clazz and all sub-types, previously added to the
accountancy. |
<E extends AccountancyEntry> |
find(java.lang.Class<E> clazz,
org.joda.time.DateTime from,
org.joda.time.DateTime 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. |
<E extends AccountancyEntry> |
find(java.lang.Class<E> clazz,
org.joda.time.DateTime from,
org.joda.time.DateTime to,
org.joda.time.Period period)
Returns all
AccountancyEntry s of type clazz and
all sub-types, which have their date within (including)
from and to . |
<E extends AccountancyEntry> |
get(java.lang.Class<E> clazz,
AccountancyEntryIdentifier accountancyEntryIdentifier)
Returns the
AccountancyEntry of type clazz and
all sub-types, identified by AccountancyEntryIdentifier . |
<E extends AccountancyEntry> |
salesVolume(java.lang.Class<E> clazz,
org.joda.time.DateTime from,
org.joda.time.DateTime to,
org.joda.time.Period period)
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 . |
void add(AccountancyEntry accountancyEntry)
AccountancyEntry
to this Accountancy
.accountancyEntry
- entry to be added to the accountancy<E extends AccountancyEntry> java.lang.Iterable<E> find(java.lang.Class<E> clazz)
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.E
- common super type of all entries returnedclazz
- Class object corresponding to the type of the entries to be
returned, has to implement AccountancyEntry
Iterable
containing all entries of type clazz<E extends AccountancyEntry> E get(java.lang.Class<E> clazz, 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 returnedclazz
- 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
<E extends AccountancyEntry> java.lang.Iterable<E> find(java.lang.Class<E> clazz, org.joda.time.DateTime from, org.joda.time.DateTime 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.E
- common super type of all entries returnedfrom
- DateTime
denoting the start of the requested time periodto
- DateTime
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 E<E extends AccountancyEntry> java.util.Map<org.joda.time.Interval,java.lang.Iterable<E>> find(java.lang.Class<E> clazz, org.joda.time.DateTime from, org.joda.time.DateTime to, org.joda.time.Period period)
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
E
- 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
period
- 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
<E extends AccountancyEntry> java.util.Map<org.joda.time.Interval,Money> salesVolume(java.lang.Class<E> clazz, org.joda.time.DateTime from, org.joda.time.DateTime to, org.joda.time.Period period)
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.E
- common super type of all entries returnedclazz
- class type of the requested entries; has implement
AccountancyEntry
from
- all returned entries will have a time stamp after
from
to
- all returned entries will have a time stamp before
to
period
- length of the time intervals, the period between
from
and to
is dividedperiod
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