hibernate / hibernate-models

An abstraction over "reflection" and annotations
Apache License 2.0
2 stars 5 forks source link

Add MutableAnnotationTarget#replaceAnnotationUsage #73

Closed sebersole closed 2 months ago

sebersole commented 2 months ago

Add MutableAnnotationTarget#replace which replaces an annotation, kind of a combination of apply and add.

Works "across" repeatables and containers. E.g. replacing @SecondaryTable will also replace @SecondaryTables, etc.

Initial proposed API:

interface MutableAnnotationTarget {
    ...

    <A extends Annotation> MutableAnnotationUsage<A> replace(AnnotationDescriptor<A> descriptor);
    <S extends Annotation, P extends Annotation> MutableAnnotationUsage<P> replace(AnnotationDescriptor<S> singular, AnnotationDescriptor<P> plural);
}