Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 10x 10x 1706x 1706x 1706x | import { AnnotationRef } from './annotation-ref';
import { Annotation, AnnotationKind, AnnotationStub } from './annotation.types';
import type { AnnotationTarget } from './target/annotation-target';
/**
* Holds data about the execution context where the annotation is being invoked.
*/
export class AnnotationContext<
T extends AnnotationKind = AnnotationKind,
S extends AnnotationStub = AnnotationStub,
X = unknown,
> {
/**
* The reference to the annotation being invked.
*/
public readonly ref: AnnotationRef;
/**
* @param ref @internal
*/
constructor(
/**
* The annotation, or its reference, that is being invoked.
*/
ref: Annotation | AnnotationRef,
/**
* The arguments passed to the annotation.
*/
public readonly args: Parameters<S>,
/**
* The target of the annotation.
*/
public readonly target: AnnotationTarget<T, X>,
) {
this.ref = AnnotationRef.of(ref);
}
/**
*
* @returns The signature of the annotation, in the form `@<groupId>:<name> on <target>`.
*/
toString(): string {
return `@${this.ref.groupId}:${this.ref.name} on ${this.target.label}`;
}
}
|