HaxeDoc2

(やまだぃちぅ) #1

10 @:noCompletion
11 static function method() { }
12 }
13
14 class Main {
15 static public function main() {
16 // { author : ["Nicolas"], debug: null }
17 trace(Meta.getType(MyClass));
18 // [1,8]
19 trace(Meta.getFields(MyClass).value.range);
20 // { broken: null }
21 trace(Meta.getStatics(MyClass).method);
22 }
23 }


We can easily identify metadata by the leading@character, followed by the metadata name
and, optionally, by a number of comma-separated constant arguments enclosed in parentheses.


  • ClassMyClasshas anauthormetadata with a single String argument"Nicolas", as
    well as adebugmetadata without arguments.

  • The member variablevaluehas arangemetadata with two Int arguments 1 and 8.

  • The static methodmethodhas abrokenmetadata without arguments, as well as a:noCompletion
    metadata without arguments.


Themainmethod accesses these metadata values using their API. The output reveals the
structure of the obtained data:


  • There is a field for each metadata, with the field name being the metadata name.

  • The field values correspond to the metadata arguments. If there are no arguments, the field
    value isnull. Otherwise the field value is an array with one element per argument.

  • Metadata starting with:is omitted. This kind of metadata is known ascompiler metadata.


Allowed values for metadata arguments are:


  • Constants (5.2)

  • Arrays declarations (5.5) (if all their elements qualify)

  • Object declarations (5.6) (if all their field values qualify)


6.10 Access Control........................................


Access control can be used if the basic visibility (4.4.1) options are not sufficient. It is applicable
atclass-leveland atfield-leveland knows two directions:

Allowing access:The target is granted access to the given class or field by using the:allow(target)
metadata (6.9).

Forcing access:A target is forced to allow access to the given class or field by using the:access(target)
metadata (6.9).
Free download pdf