Skip to content

Simplified creation and addition of AnnotationUsage references #54

@sebersole

Description

@sebersole
interface MutableAnnotationTarget ... {
	...

	/**
	 * Creates a usage and adds it to this target.
	 */
	default <A extends Annotation> MutableAnnotationUsage<A> applyAnnotationUsage(
			AnnotationDescriptor<A> annotationType,
			SourceModelBuildingContext buildingContext) {
		return applyAnnotationUsage( annotationType, null, buildingContext );
	}

	/**
	 * Creates a usage and adds it to this target, allowing for configuration of the created usage
	 */
	default <A extends Annotation> MutableAnnotationUsage<A> applyAnnotationUsage(
			AnnotationDescriptor<A> annotationType,
			Consumer<MutableAnnotationUsage<A>> configuration,
			SourceModelBuildingContext buildingContext) {
		final MutableAnnotationUsage<A> usage = annotationType.createUsage( this, configuration, buildingContext );
		addAnnotationUsage( usage );
		return usage;
	}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions