}
newEntityAccessor = new EntityFieldAccessor(entityAccessor, field);
} else if (field.isAnnotationPresent(CommandHandlingMemberCollection.class)) {
CommandHandlingMemberCollection annotation = field.getAnnotation(CommandHandlingMemberCollection.class);
if (!Collection.class.isAssignableFrom(field.getType())) {
throw new AxonConfigurationException(String.format(
"Field %s.%s is annotated with @CommandHandlingMemberCollection, but the declared type of "
+ "the field is not assignable to java.util.Collection.",
targetType.getSimpleName(), field.getName()));
}
Class<?> entityType = annotation.entityType();
if (AbstractAnnotatedEntity.class.equals(entityType)) {
final Type genericType = field.getGenericType();
if (genericType == null
|| !(genericType instanceof ParameterizedType)
|| ((ParameterizedType) genericType).getActualTypeArguments().length == 0) {
throw new AxonConfigurationException(String.format(
"Field %s.%s is annotated with @CommandHandlingMemberCollection, but the entity"
+ " type is not indicated on the annotation, "
+ "nor can it be deducted from the generic parameters",
targetType.getSimpleName(), field.getName()));
}