AnnotationAggregate
Base trait for annotations that aggregate multiple other annotations. An aggregate annotation works like an "annotation function" — applying it to a symbol behaves as if all the annotations declared on its aggregated method were applied directly.
To declare an aggregate, extend AnnotationAggregate and implement the aggregated method via the reifyAggregated macro. The aggregated annotations must be declared on that implementation method itself. The implementation must be final.
Constructor parameters of the aggregate may be referenced as arguments to inner annotations and will be substituted at the application site:
class customName(name: String) extends AnnotationAggregate {
@name(name)
final def aggregated: List[StaticAnnotation] = reifyAggregated
}
Made's annotation lookup machinery (hasAnnotation/getAnnotation on mirror elements, label resolution and metadata) automatically expands aggregates so that downstream code sees the underlying annotations directly.
Attributes
- Graph
-
- Supertypes