Giter Club home page Giter Club logo

hexannotation's Introduction

hexAnnotation TravisCI Build Status

Utilities for reading and writing class metadata

Find more information about hexMachina on hexmachina.org

Dependencies

Features

  • 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
  • Replaces expressions in annotations with their respective values

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 );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.