Skip to content
This repository has been archived by the owner on Feb 6, 2020. It is now read-only.

Latest commit

 

History

History
56 lines (39 loc) · 1.57 KB

README.md

File metadata and controls

56 lines (39 loc) · 1.57 KB

fussy is an actionscript reflection query language

Fussy allows you to query your actionscript types using a simple DSL

Why

Because I didn't need a full OO representation of my types, I just needed to know some specific things about them

How

Fussy allows you to perform the business logic of you reflection (find me such-and-such) with a query language, then only parses into strictly typed objects those facets of the type that satisfy your query

Code

Want to know somethings about some types? Create a Fussy.

var fussy:Fussy = new Fussy()

Explain what you want to know by creating a query

var query:IQuery = fussy.query().findMethods().withTypeSignature(int, String);

This will find any methods that have a signiture of int, string e.g. public function setAgeAndName(age:int, name:String):void; or public function addToCart(prodId:int, name:String):void;

Now to use the query

var methods:Array = query.forType(Person);

Result is strongly typed into Method objects

for each(var method:Method in methods)
{
  trace(method.name);
  trace(method.parameters.length);
  method.invoke(myPerson, [1, "Bacon"]);
}

And some more...

Take from dawns code base

var query:QueryBuilder = fussy.query();

query.findMethods().withMetadata("Inject").withArguments();
query.findProperties().withMetadata("Inject");
query.findMethods().withMetadata("Provider").noCompulsoryArguments();
query.findMethods().withMetadata("Execute").withArgsLengthOf(1);
query.getTypeQuery();