Open sandboxFocus

Struct DeclarationEnhancements<T>

Provides access to aspects, options, and annotations applied to a declaration. This allows querying metadata added by aspects and accessing hierarchical configuration.

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct DeclarationEnhancements<T> where T : class, IDeclaration
Type Parameters
Name Description
T

The type of declaration.

Remarks

Access this API through the Enhancements<T>(T) extension method on any IDeclaration. It provides methods to:

Important limitation: Aspect queries only return aspects that have already been applied or are currently being applied. You can query aspects ordered before the current aspect, or instances of the current aspect applied in a parent class, but you cannot query aspects ordered after the current one.

Methods

Name Description
GetAnnotations<TAnnotation>()

Gets the list of annotations of a given type on the current declaration.

GetAspectInstances()

Gets the set of aspects (represented by their IAspectInstance) that have been applied to the current declaration.

GetAspects<TAspect>()

Gets the set of instances of a specified type of aspects that have been applied to the current declaration.

GetOptions<TOptions>()

Gets the options effective for the current declarations. Options provided by aspects through the IHierarchicalOptionsProvider are available only when and after the given aspect instance has been initialized; options provided by other means are available immediately.

HasAspect(Type)

Determines if the current declaration has at least one aspect of the given type.

HasAspect<TAspect>()

Determines if the current declaration has at least one aspect of the given type.

See Also