AggregateType class
Use AggregateType to define aggregates
Optional AggregateType fields for parameterized types when not given are inferred by introspection or restricted to default Types. If Eventuous.inferTypes is true (default) parameterized types are inferred by introspection of annotations associated with AggregateType. If introspection fails or Eventuous.inferTypes is false, parameterized types are given by (default) naming convention where applicable, or restricted to a default Type otherwise.
Following rules apply when fields in AggregateType for parameterized types are not given:
- AggregateType.id (parameterized type
TId
) - inferred from name of class annotated with AggregateIdType and associated with AggregateType. If introspection fails (no association found) or Eventuous.inferTypes is false,TId
is given by name of class annotated with AggregateType (default naming convention is "${aggregate}Id").
@AggregateType()
class Foo extends _$Foo
@AggregateType(Foo) // => infers TId is FooId1
class FooId1 extends AggregateId;
AggregateType.data
(parameterized typeTData
) - used in AggregateEventCreator to createTEvent
s fromTData
. Inferred from classes annotated with AggregateEventTypes and associated with AggregateType. If introspection fails (no associations found or type can not be derived from them) or Eventuous.inferTypes is false,TData
is restricted to type JsonMap.
@AggregateType()
class Foo extends _$Foo {}
@JsonSerializable() // => infers TData is JsonMap
@AggregateEventType(Foo) // => links FooCreated with Foo
class FooCreated extends _$FooCreated {}
- AggregateType.event (parameterized type
TEvent
) - used in AggregateEventCreator to createTEvent
s fromTData
. Inferred from classes annotated with AggregateEventTypes and associated with AggregateType. If introspection fails (no associations found or type can not be derived from them) or Eventuous.inferTypes is false,TEvent
is restricted to type JsonObject.
@AggregateType()
class Foo extends _$Foo {}
@JsonSerializable() // => TEvent is JsonObject
@AggregateEventType(Foo) // => links FooCreated with Foo
class FooCreated extends _$FooCreated {}
- AggregateType.value (parameterized type
TValue
) - inferred from name of class annotated with AggregateValueTypes and associated with AggregateType. If introspection fails (no associations found) or Eventuous.inferTypes is false,TValue
is given by name of class annotated with AggregateType (default naming convention is "${aggregate}Value").
@AggregateType()
class Foo extends _$Foo {}
@JsonSerializable() // => infers TValue is JsonObject
@AggregateValueType(Foo) // => infers TValue is FooValue1
class FooValue1 _$FooState {}
- AggregateType.state (parameterized type
TState
) - inferred from name of class annotated with AggregateStateTypes and associated with AggregateType. If introspection fails (no associations found) or Eventuous.inferTypes is false,TState
is given by name of class annotated with AggregateType (default naming convention is "${aggregate}State").
@AggregateType()
class Foo extends _$Foo {}
@AggregateStateType(Foo) // => infers TState is FooState1
class FooState1 _$FooState {}
Constructors
- AggregateType({Type? id, Type? event, Type? value, Type? state})
-
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
String aggregate) → JsonMap -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited