Class<?> propertyType = propertyMethod.getType();
if (Collection.class.isAssignableFrom(propertyType)) {
Type genericType = propertyMethod.getGenericType();
ParameterizedType type = (ParameterizedType) genericType;
Class<?> typeArgument = (Class<?>) type.getActualTypeArguments()[0];
AnnotatedType annotatedTypeArgument = new AnnotatedType(typeArgument);
if (isEntityType(annotatedTypeArgument)) {
Direction relationDirection = getRelationDirection(propertyMethod, Direction.FROM);
com.buschmais.cdo.spi.reflection.AnnotatedElement<?> relationElement = getRelationDefinitionElement(propertyMethod);
RelationTypeMetadata relationshipType = new RelationTypeMetadata<>(metadataFactory.createRelationMetadata(relationElement, metadataByType));
methodMetadata = new EntityCollectionPropertyMethodMetadata<>(propertyMethod, relationshipType, relationDirection,
metadataFactory.createCollectionPropertyMetadata(propertyMethod));
} else if (isRelationType(annotatedTypeArgument)) {
TypeMetadata relationTypeMetadata = getOrCreateTypeMetadata(typeArgument);
RelationTypeMetadata<RelationMetadata> relationMetadata = (RelationTypeMetadata) relationTypeMetadata;
Direction relationDirection = getRelationDirection(annotatedType, propertyMethod, relationTypeMetadata, relationMetadata);
methodMetadata = new RelationCollectionPropertyMethodMetadata<>(propertyMethod, relationMetadata, relationDirection,
metadataFactory.createCollectionPropertyMetadata(propertyMethod));
} else {
throw new CdoException("Unsupported type argument '" + typeArgument.getName() + "' for collection property: " + propertyType.getName());
}
} else if (annotatedMethods.containsKey(propertyType)) {
AnnotatedType referencedType = new AnnotatedType(propertyType);
Direction relationDirection;
RelationTypeMetadata<RelationMetadata> relationMetadata;
if (isEntityType(referencedType)) {
relationDirection = getRelationDirection(propertyMethod, Direction.FROM);
com.buschmais.cdo.spi.reflection.AnnotatedElement<?> relationElement = getRelationDefinitionElement(propertyMethod);