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

sammyt/fussy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

actionscript reflection query language

Resources

Stars

Watchers

Forks

Packages

No packages published