hibernate / hibernate-models

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

Add AnnotationDescriptor#createUsage for creating "defaulted" usages #15

Closed sebersole closed 5 months ago

sebersole commented 5 months ago

Specifically for creating AnnotationUsage references with all default values applied.

interface AnnotationDescriptor<A extends Annotation> extends AnnotationTarget {
    ...

    /**
     * Create a usage of this annotation with all attribute values defaulted.
     */
    AnnotationUsage<A> createUsage(AnnotationTarget target);

    /**
     * Create a usage of this annotation with all attribute values defaulted, allowing customization prior to return
     */
    AnnotationUsage<A> createUsage(AnnotationTarget target, Consumer<AnnotationUsage<A>> initializer);
}