Closed
Description
Make supporting @\TypeAlias the default behavior. This currently requires a CustomMappingCouchbaseConverter which uses a TypeBasedTypeMapper which uses a TypeAwareInformationMapper - see src/test/java/org/springframework/data/couchbase/domain/Config
By packaging and using that TypeAwareInformationMapper (that considers @\TypeAlias) instead of Simple
public DefaultCouchbaseTypeMapper(final String typeKey) {
//super(new CouchbaseDocumentTypeAliasAccessor(typeKey));
super(new CouchbaseDocumentTypeAliasAccessor(typeKey), (MappingContext)null, Collections.singletonList(new TypeAwareTypeInformationMapper()));
this.typeKey = typeKey;
}
override this:
public Alias createAliasFor(TypeInformation<?> type) {
return Alias.of(type.getType().getName());
}
with this:
@Override
public Alias createAliasFor(TypeInformation<?> type) {
TypeAlias[] typeAlias = type.getType().getAnnotationsByType(TypeAlias.class);
if (typeAlias.length == 1) {
return Alias.of(typeAlias[0].value());
}
return super.createAliasFor(type);
}