Class AggregateMemberAnnotatedChildEntityCollectionDefinition
java.lang.Object
org.axonframework.modelling.command.inspection.AbstractChildEntityDefinition
org.axonframework.modelling.command.inspection.AggregateMemberAnnotatedChildEntityCollectionDefinition
- All Implemented Interfaces:
ChildEntityDefinition
public class AggregateMemberAnnotatedChildEntityCollectionDefinition
extends AbstractChildEntityDefinition
Implementation of a
AbstractChildEntityDefinition that is used to detect Collections of entities (member type
assignable to Iterable) annotated with AggregateMember. If such a field or method is found a ChildEntity is created that delegates to the entities in the annotated collection.- Since:
- 3.0
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> EntityModel<Object> extractChildEntityModel(EntityModel<T> declaringEntity, Map<String, Object> attributes, Member member) Extracts the Child Entity contained in the givendeclaringEntityas anEntityModel.protected booleanisMemberTypeSupported(Member member) Check whether the givenMemberis of a type supported by this definition.protected <T> ObjectresolveCommandTarget(CommandMessage<?> msg, T parent, Member member, EntityModel<Object> childEntityModel) Resolve the target of an incomingCommandMessageto the right Child Entity.resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) Resolve the targets of an incomingEventMessageto the right Child Entities.Methods inherited from class org.axonframework.modelling.command.inspection.AbstractChildEntityDefinition
createChildDefinition, extractCommandHandlerRoutingKeys, isFieldTypeSupported
-
Constructor Details
-
AggregateMemberAnnotatedChildEntityCollectionDefinition
public AggregateMemberAnnotatedChildEntityCollectionDefinition()
-
-
Method Details
-
isMemberTypeSupported
Description copied from class:AbstractChildEntityDefinitionCheck whether the givenMemberis of a type supported by this definition.- Specified by:
isMemberTypeSupportedin classAbstractChildEntityDefinition- Parameters:
member- aMembercontaining or returning a Child Entity- Returns:
- true if the type is as required by the implementation and false if it is not
-
extractChildEntityModel
protected <T> EntityModel<Object> extractChildEntityModel(EntityModel<T> declaringEntity, Map<String, Object> attributes, Member member) Description copied from class:AbstractChildEntityDefinitionExtracts the Child Entity contained in the givendeclaringEntityas anEntityModel. The type of the Child Entity is defined through a key in the providedattributesor based on givenField.- Specified by:
extractChildEntityModelin classAbstractChildEntityDefinition- Type Parameters:
T- the typeTof the givendeclaringEntityEntityModel- Parameters:
declaringEntity- theEntityModeldeclaring the givenfieldattributes- aMapcontaining theAggregateMemberattributesmember- theMembercontaining the Child Entity.- Returns:
- the Child Entity contained in the
declaringEntity
-
resolveCommandTarget
protected <T> Object resolveCommandTarget(CommandMessage<?> msg, T parent, Member member, EntityModel<Object> childEntityModel) Description copied from class:AbstractChildEntityDefinitionResolve the target of an incomingCommandMessageto the right Child Entity. Returns the Child Entity themsgneeds to be routed to.- Specified by:
resolveCommandTargetin classAbstractChildEntityDefinition- Type Parameters:
T- the typeTof the givenparentEntity- Parameters:
msg- theCommandMessagewhich is being resolved to a target entityparent- theparentEntity of typeTof this Child Entitymember- theMembercontaining the Child Entity.childEntityModel- theEntityModelfor the Child Entity- Returns:
- the Child Entity which is the target of the incoming
CommandMessage.
-
resolveEventTargets
protected <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) Description copied from class:AbstractChildEntityDefinitionResolve the targets of an incomingEventMessageto the right Child Entities. Returns aStreamof all the Child Entities the Event Message should be routed to.- Specified by:
resolveEventTargetsin classAbstractChildEntityDefinition- Type Parameters:
T- the typeTof the givenparentEntity- Parameters:
message- theEventMessageto routeparentEntity- theparentEntity of typeTof this Child Entitymember- theMembercontaining the Child EntityeventForwardingMode- theForwardingModeused to filter themessageto route based on the ForwardingMode implementation- Returns:
- a filtered
Streamof Child Entity targets for the incomingEventMessage
-