public abstract class AbstractChildEntityDefinition extends Object implements ChildEntityDefinition
ChildEntityDefinition
to provide reusable functionality for collections of
ChildEntityDefinitions.Constructor and Description |
---|
AbstractChildEntityDefinition() |
Modifier and Type | Method and Description |
---|---|
<T> Optional<ChildEntity<T>> |
createChildDefinition(Member member,
EntityModel<T> declaringEntity)
Inspect the given
member , which is declared on the given declaringEntity for the presence of a
Child Entity. |
protected abstract <T> EntityModel<Object> |
extractChildEntityModel(EntityModel<T> declaringEntity,
Map<String,Object> attributes,
Member member)
Extracts the Child Entity contained in the given
declaringEntity as an EntityModel . |
protected Map<String,Property<Object>> |
extractCommandHandlerRoutingKeys(Member member,
EntityModel<Object> childEntityModel)
Retrieves the routing keys of every command handler on the given
childEntityModel to be able to correctly
route commands to Entities. |
protected boolean |
isFieldTypeSupported(Field field)
Deprecated.
in favour of
isMemberTypeSupported(Member) |
protected abstract boolean |
isMemberTypeSupported(Member member)
Check whether the given
Member is of a type supported by this definition. |
protected abstract <T> Object |
resolveCommandTarget(CommandMessage<?> msg,
T parent,
Member member,
EntityModel<Object> childEntityModel)
Resolve the target of an incoming
CommandMessage to the right Child Entity. |
protected abstract <T> Stream<Object> |
resolveEventTargets(EventMessage message,
T parentEntity,
Member member,
ForwardingMode eventForwardingMode)
Resolve the targets of an incoming
EventMessage to the right Child Entities. |
public <T> Optional<ChildEntity<T>> createChildDefinition(Member member, EntityModel<T> declaringEntity)
ChildEntityDefinition
member
, which is declared on the given declaringEntity
for the presence of a
Child Entity.createChildDefinition
in interface ChildEntityDefinition
T
- the type of entity on which the field is declaredmember
- the member potentially containing a Child entitydeclaringEntity
- the entity model declaring the field@Deprecated protected boolean isFieldTypeSupported(Field field)
isMemberTypeSupported(Member)
Field
is of a type supported by this definition.field
- a Field
containing a Child Entityprotected abstract boolean isMemberTypeSupported(Member member)
Member
is of a type supported by this definition.member
- a Member
containing or returning a Child Entityprotected abstract <T> EntityModel<Object> extractChildEntityModel(EntityModel<T> declaringEntity, Map<String,Object> attributes, Member member)
declaringEntity
as an EntityModel
. The type of
the Child Entity is defined through a key in the provided attributes
or based on given Field
.T
- the type T
of the given declaringEntity
EntityModel
declaringEntity
- the EntityModel
declaring the given field
attributes
- a Map
containing the AggregateMember
attributesmember
- the Member
containing the Child Entity.declaringEntity
protected abstract <T> Object resolveCommandTarget(CommandMessage<?> msg, T parent, Member member, EntityModel<Object> childEntityModel)
CommandMessage
to the right Child Entity. Returns the Child Entity the
msg
needs to be routed to.T
- the type T
of the given parent
Entitymsg
- the CommandMessage
which is being resolved to a target entityparent
- the parent
Entity of type T
of this Child Entitymember
- the Member
containing the Child Entity.childEntityModel
- the EntityModel
for the Child EntityCommandMessage
.protected Map<String,Property<Object>> extractCommandHandlerRoutingKeys(Member member, EntityModel<Object> childEntityModel)
childEntityModel
to be able to correctly
route commands to Entities.member
- a Member
denoting the Child Entity upon which the childEntityModel
is
basedchildEntityModel
- a EntityModel
to retrieve the routing key properties fromMap
of key/value types String
Property
from Command Message name to routing keyprotected abstract <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode)
EventMessage
to the right Child Entities. Returns a Stream
of
all the Child Entities the Event Message should be routed to.T
- the type T
of the given parent
Entitymessage
- the EventMessage
to routeparentEntity
- the parent
Entity of type T
of this Child Entitymember
- the Member
containing the Child EntityeventForwardingMode
- the ForwardingMode
used to filter the message
to route based on the
ForwardingMode implementationStream
of Child Entity targets for the incoming EventMessage
Copyright © 2010–2020. All rights reserved.