I
- the type for IDs of this class of aggregatesS
- the type of the state held by the aggregate partB
- the type of the aggregate part state builderR
- the type of the aggregate root@Experimental public abstract class AggregatePart<I,S extends io.spine.base.EntityState,B extends io.spine.protobuf.ValidatingBuilder<S>,R extends AggregateRoot<I>> extends Aggregate<I,S,B>
Some business logic objects may be big enough. If not all parts of such a business object need to be preserved at the same time as business logic invariants, such an object can be split into several parts.
Each such part would:
AggregatePart
AggregateRepository
To access parts of the aggregate, AggregateRoot
should be used.
If your business logic cannot be split into parts, it can be modified separately.
Consider extending Aggregate
instead of several AggregatePart
s.
Aggregate
Modifier and Type | Class and Description |
---|---|
static class |
AggregatePart.GenericParameter
Enumeration of generic type parameters of this class.
|
Modifier | Constructor and Description |
---|---|
protected |
AggregatePart(R root)
Creates a new instance of the aggregate part.
|
Modifier and Type | Method and Description |
---|---|
protected <P extends io.spine.base.EntityState> |
partState(java.lang.Class<P> partStateClass)
Obtains a state of another
AggregatePart by its class. |
protected AggregatePartClass<?> |
thisClass()
Obtains model class for this aggregate part.
|
builder, clearRecentHistory, dispatchCommand, historyBackward, historyContains, missingTxMessage, play, recentHistory, versionNumber
expectedDefault, expectedEmpty, expectedNotDefault, expectedNotDefault, expectedNotEmpty, producerId, unexpectedValue, unexpectedValue
getLifecycleFlags, remember, setArchived, setDeleted, setInitialState, tx
afterInvoke, at, beforeInvoke, checkEntityState, checkNotArchived, checkNotDeleted, defaultState, equals, hashCode, id, idAsString, isArchived, isDeleted, lifecycleFlagsChanged, state, toString, version, whenModified
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
nothing, producedEvents, producerId, version
isActive, lifecycleFlags
protected AggregatePart(R root)
root
- a root of the aggregate to which this part belongsprotected AggregatePartClass<?> thisClass()
protected <P extends io.spine.base.EntityState> P partState(java.lang.Class<P> partStateClass)
AggregatePart
by its class.P
- the type of the part statepartStateClass
- the class of the state of the partjava.lang.IllegalStateException
- if a repository was not found,
or the ID type of the part state does not match
the ID type of the root