MetaAccess

package haxe.macro

import haxe.macro.Type

Available on all platforms

MetaAccess is a wrapper for the Metadata array. It can be used to add metadata to and remove metadata from its origin.

Fields

remove(name:String):Void

Removes all `name` metadata entries from the origin of `this` MetaAccess. This method might clear several metadata entries of the same name. If a `Metadata` array is obtained through a call to `get`, a subsequent call to `remove` has no effect on that array. If `name` is null, compilation fails with an error.

has(name:String):Bool

Tells if the origin of `this` MetaAccess has a `name` metadata entry. If `name` is null, compilation fails with an error.

get():Metadata

Return the wrapped `Metadata` array. Modifying this array has no effect on the origin of `this` MetaAccess. The `add` and `remove` methods can be used for that.

extract(name:String):Array<MetadataEntry>

Extract metadata entries by given `name`. If there's no metadata with such name, empty array `[]` is returned. If `name` is null, compilation fails with an error.

add(name:String, params:Array<Expr>, pos:Position):Void

Adds the metadata specified by `name`, `params` and `pos` to the origin of `this` MetaAccess. Metadata names are not unique during compilation, so this method never overwrites a previous metadata. If a `Metadata` array is obtained through a call to `get`, a subsequent call to `add` has no effect on that array. If any argument is null, compilation fails with an error.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/haxe/macro/MetaAccess.html