Utilities for reading and writing metadata

To install, run:

haxelib install hexannotation 1.0.0-alpha.3 

See using Haxelib in Haxelib documentation for more information.


hexAnnotation TravisCI Build Status

Utilities for reading and writing class metadata

Find more information about hexMachina on hexmachina.org



  • Read metadata at compile time.
  • Handles inheritance chain.
  • Read properties and methods signatures (to be used by DI frameworks).
  • Use hexReflection to export annotated (@Inject, @PostConstruct", @Optional, @PreDestroy) members information (essentially reflection data) to a static field instance.
  • Generates logging statements based on method annotations
  • More info here
  • Replaces expressions in annotations with their respective values
  • More info here

Simple example

To generate a class description at compile-time, implement IInjectorContainer and add annotations on the members that you want to produce reflection.

class MockClassInjectee implements IInjectorContainer
	@Inject( "id" )
	public var property : String;
	//property informations will be stored
	@Inject( "id" )
	public function new( arg : Int ) 
		//constructor informations will be stored
	public function doSomething() : Void
		//this method will be ignored
	@PostConstruct( 1 )
	public function doSomething() : Void
		//this method description will be stored as well

To get your reflection data at runtime, use FastClassDescriptionProvider like shown below.

var provider = new FastClassDescriptionProvider();
var description = provider.getClassDescription( MockClassInjectee );
1 week ago

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github