diff --git a/.gitignore b/.gitignore
index f1f272e..fbfa205 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
.FlexUnitSettings
.project
.DS_Store
+bin-debug/
*bin/
fussy.iml
fussy.ipr
diff --git a/README.md b/README.md
index 6934f36..5c61a06 100644
--- a/README.md
+++ b/README.md
@@ -1,56 +1 @@
-# 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](http://github.com/sammyt/dawn) 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();
-
\ No newline at end of file
+Entirely based on the excellent work of Sam Williams in his [Fussy](https://github.com/sammyt/fussy) library, check it out!
diff --git a/pom.xml b/pom.xml
index 4932f00..533b357 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,49 +2,28 @@
4.0.0
- uk.co.ziazoo
- fussy
- 0.2
+
+ se.stade
+ daffodil
+ 0.1
swc
- Fussy query language
+
+ Daffodil
+
- 3.5.0.12683
- 3.5.0
+ 4.1.0.16076
+ 3.8
-
- src
- test
-
-
- org.sonatype.flexmojos
- flexmojos-maven-plugin
- ${mojoversion}
- true
-
-
-
- Inject
- Fussy
-
-
-
-
- com.adobe.flex
- compiler
- ${flexversion}
- pom
-
-
-
-
-
+
+
com.adobe.flex.framework
flex-framework
${flexversion}
pom
+
org.sonatype.flexmojos
flexmojos-unittest-support
@@ -52,6 +31,7 @@
swc
test
+
com.adobe.flexunit
flexunit
@@ -59,5 +39,28 @@
swc
test
+
+
+
+ src
+ test
+
+
+ org.sonatype.flexmojos
+ flexmojos-maven-plugin
+ ${mojoversion}
+ true
+
+
+
+ com.adobe.flex
+ compiler
+ ${flexversion}
+ pom
+
+
+
+
+
\ No newline at end of file
diff --git a/src/se/stade/daffodil/Reflect.as b/src/se/stade/daffodil/Reflect.as
new file mode 100644
index 0000000..64cbb79
--- /dev/null
+++ b/src/se/stade/daffodil/Reflect.as
@@ -0,0 +1,31 @@
+package se.stade.daffodil
+{
+ import se.stade.daffodil.methods.MethodReflection;
+ import se.stade.daffodil.properties.ConstantReflection;
+ import se.stade.daffodil.properties.PropertyReflection;
+
+ public class Reflect
+ {
+ private static var cache:XMLDescriptionCache = new XMLDescriptionCache();
+
+ public static function on(target:Object):Reflector
+ {
+ return new XMLReflector(cache, target);
+ }
+
+ public static function get methods():MethodReflection
+ {
+ return new XMLMethodReflection();
+ }
+
+ public static function get properties():PropertyReflection
+ {
+ return new XMLPropertyReflection();
+ }
+
+ public static function get constants():ConstantReflection
+ {
+ return new XMLConstantReflection();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/Reflection.as b/src/se/stade/daffodil/Reflection.as
new file mode 100644
index 0000000..36c9420
--- /dev/null
+++ b/src/se/stade/daffodil/Reflection.as
@@ -0,0 +1,7 @@
+package se.stade.daffodil
+{
+ public interface Reflection
+ {
+ function matches(input:*):Boolean;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/Reflector.as b/src/se/stade/daffodil/Reflector.as
new file mode 100644
index 0000000..34f9c42
--- /dev/null
+++ b/src/se/stade/daffodil/Reflector.as
@@ -0,0 +1,7 @@
+package se.stade.daffodil
+{
+ public interface Reflector
+ {
+ function find(reflection:Reflection):Array;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/TypeMember.as b/src/se/stade/daffodil/TypeMember.as
new file mode 100644
index 0000000..5049fad
--- /dev/null
+++ b/src/se/stade/daffodil/TypeMember.as
@@ -0,0 +1,12 @@
+package se.stade.daffodil
+{
+ import se.stade.daffodil.metadata.Metadata;
+
+ public interface TypeMember
+ {
+ function get name():String;
+ function get type():String;
+
+ function get metadata():Vector.;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLAbstractReflection.as b/src/se/stade/daffodil/XMLAbstractReflection.as
new file mode 100644
index 0000000..2714459
--- /dev/null
+++ b/src/se/stade/daffodil/XMLAbstractReflection.as
@@ -0,0 +1,65 @@
+package se.stade.daffodil
+{
+ import flash.utils.getQualifiedClassName;
+
+ internal class XMLAbstractReflection
+ {
+ protected static function createNameMatcher(name:String):Function
+ {
+ return function(input:XML):Boolean
+ {
+ return input.@name == name;
+ }
+ }
+
+ protected static function createMetadataMatcher(name:String):Function
+ {
+ return function(input:XML):Boolean
+ {
+ for each (var metadata:XML in input.metadata)
+ {
+ if (metadata.@name == name)
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ protected static function createReturnTypeMatcher(type:Class, isMethod:Boolean):Function
+ {
+ var qName:String = getQualifiedClassName(type);
+
+ if (isMethod) return function(input:XML):Boolean
+ {
+ return input.@returnType == qName;
+ }
+ else return function(input:XML):Boolean
+ {
+ return input.@type == qName;
+ }
+ }
+
+ public final function XMLAbstractReflection()
+ {
+ nameMatches = signatureMatches = metadataMatches = returnTypeMatches = function(input:XML):Boolean
+ {
+ return true;
+ };
+ }
+
+ protected var nameMatches:Function;
+ protected var metadataMatches:Function;
+ protected var signatureMatches:Function;
+ protected var returnTypeMatches:Function;
+
+ public final function matches(input:*):Boolean
+ {
+ return input is XML &&
+ nameMatches(input) &&
+ metadataMatches(input) &&
+ signatureMatches(input) &&
+ returnTypeMatches(input);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLConstantReflection.as b/src/se/stade/daffodil/XMLConstantReflection.as
new file mode 100644
index 0000000..4c0ca5d
--- /dev/null
+++ b/src/se/stade/daffodil/XMLConstantReflection.as
@@ -0,0 +1,25 @@
+package se.stade.daffodil
+{
+ import se.stade.daffodil.properties.ConstantReflection;
+
+ internal final class XMLConstantReflection extends XMLAbstractReflection implements ConstantReflection
+ {
+ public function named(name:String):ConstantReflection
+ {
+ nameMatches = createNameMatcher(name);
+ return this;
+ }
+
+ public function ofType(type:Class):ConstantReflection
+ {
+ returnTypeMatches = createReturnTypeMatcher(type, false);
+ return this;
+ }
+
+ public function withMetadata(name:String):ConstantReflection
+ {
+ metadataMatches = createMetadataMatcher(name);
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLDescriptionCache.as b/src/se/stade/daffodil/XMLDescriptionCache.as
new file mode 100644
index 0000000..fffd8e0
--- /dev/null
+++ b/src/se/stade/daffodil/XMLDescriptionCache.as
@@ -0,0 +1,20 @@
+package se.stade.daffodil
+{
+ import flash.utils.Dictionary;
+ import flash.utils.describeType;
+
+ internal final class XMLDescriptionCache
+ {
+ private var descriptions:Dictionary = new Dictionary(true);
+
+ public function retrieve(key:*):XML
+ {
+ if (key in descriptions == false)
+ {
+ descriptions[key] = describeType(key);
+ }
+
+ return descriptions[key];
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLMethodReflection.as b/src/se/stade/daffodil/XMLMethodReflection.as
new file mode 100644
index 0000000..36ea7f1
--- /dev/null
+++ b/src/se/stade/daffodil/XMLMethodReflection.as
@@ -0,0 +1,97 @@
+package se.stade.daffodil
+{
+ import flash.utils.getQualifiedClassName;
+
+ import se.stade.daffodil.methods.MethodReflection;
+
+ internal final class XMLMethodReflection extends XMLAbstractReflection implements MethodReflection
+ {
+ public function named(name:String):MethodReflection
+ {
+ nameMatches = createNameMatcher(name);
+ return this;
+ }
+
+ public function withMetadata(name:String):MethodReflection
+ {
+ metadataMatches = createMetadataMatcher(name);
+ return this;
+ }
+
+ public function get withArguments():MethodReflection
+ {
+ signatureMatches = function(input:XML):Boolean
+ {
+ return input.parameter.length() > 0;
+ };
+
+ return this;
+ }
+
+ public function get withoutArguments():MethodReflection
+ {
+ signatureMatches = function(input:XML):Boolean
+ {
+ return input.parameter.length() == 0;
+ };
+
+ return this;
+ }
+
+ public function get withOnlyOptionalArguments():MethodReflection
+ {
+ signatureMatches = function(input:XML):Boolean
+ {
+ var total:XMLList = input.parameter;
+ if (!total.length())
+ return false;
+
+ var optional:XMLList = input.parameter.(@optional == true);
+ return total.length() == optional.length();
+ };
+
+ return this;
+ }
+
+ public function withArgumentCount(count:uint):MethodReflection
+ {
+ signatureMatches = function(input:XML):Boolean
+ {
+ return input.parameter.length() == count;
+ };
+
+ return this;
+ }
+
+ public function withSignature(type:Class, ... types):MethodReflection
+ {
+ types.unshift(type);
+
+ signatureMatches = function(input:XML):Boolean
+ {
+ var typeNames:XMLList = input.parameters.@type;
+
+ if (typeNames.length() !== types.length)
+ return false;
+
+ for (var i:int = 0; i < types.length; i++)
+ {
+ var qName:String = getQualifiedClassName(types[i]);
+
+ if (typeNames[0].toString() != qName)
+ return false;
+ }
+
+ return true;
+ };
+
+ return this;
+ }
+
+ public function withReturnType(type:Class):MethodReflection
+ {
+ returnTypeMatches = createReturnTypeMatcher(type, true);
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLPropertyReflection.as b/src/se/stade/daffodil/XMLPropertyReflection.as
new file mode 100644
index 0000000..c4b0e26
--- /dev/null
+++ b/src/se/stade/daffodil/XMLPropertyReflection.as
@@ -0,0 +1,47 @@
+package se.stade.daffodil
+{
+ import se.stade.daffodil.properties.PropertyReflection;
+
+ internal final class XMLPropertyReflection extends XMLAbstractReflection implements PropertyReflection
+ {
+ public function named(name:String):PropertyReflection
+ {
+ nameMatches = createNameMatcher(name);
+ return this;
+ }
+
+ public function ofType(type:Class):PropertyReflection
+ {
+ returnTypeMatches = createReturnTypeMatcher(type, false);
+ return this;
+ }
+
+ public function withMetadata(name:String):PropertyReflection
+ {
+ metadataMatches = createMetadataMatcher(name);
+ return this;
+ }
+
+ public function get thatAreReadable():PropertyReflection
+ {
+ signatureMatches = function(input:XMLList):Boolean
+ {
+ return input.localName() == "variable" ||
+ input.@access.toString().indexOf("read") >= 0;
+ };
+
+ return this;
+ }
+
+ public function get thatAreWritable():PropertyReflection
+ {
+ signatureMatches = function(input:XML):Boolean
+ {
+ return input.localName() == "variable" ||
+ input.@access.toString().indexOf("write") >= 0;
+ };
+
+ return this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/XMLReflector.as b/src/se/stade/daffodil/XMLReflector.as
new file mode 100644
index 0000000..1bbcee3
--- /dev/null
+++ b/src/se/stade/daffodil/XMLReflector.as
@@ -0,0 +1,121 @@
+package se.stade.daffodil
+{
+ import se.stade.daffodil.metadata.Metadata;
+ import se.stade.daffodil.metadata.MetadataProperty;
+ import se.stade.daffodil.methods.Delegate;
+ import se.stade.daffodil.methods.Method;
+ import se.stade.daffodil.methods.MethodReflection;
+ import se.stade.daffodil.methods.Parameter;
+ import se.stade.daffodil.properties.Accessor;
+ import se.stade.daffodil.properties.Constant;
+ import se.stade.daffodil.properties.ConstantReflection;
+ import se.stade.daffodil.properties.Property;
+ import se.stade.daffodil.properties.PropertyReflection;
+
+ internal final class XMLReflector implements Reflector
+ {
+ public function XMLReflector(cache:XMLDescriptionCache, target:Object)
+ {
+ this.cache = cache;
+ this.target = target;
+ }
+
+ protected var cache:XMLDescriptionCache;
+ protected var target:Object;
+
+ public function find(reflection:Reflection):Array
+ {
+ var elements:XMLList;
+ var parse:Function;
+
+ if (reflection is MethodReflection)
+ {
+ parse = parseMethod;
+ elements = cache.retrieve(target).method
+ }
+ else if (reflection is PropertyReflection)
+ {
+ parse = parseProperty;
+
+ var description:XML = cache.retrieve(target);
+ elements = description.accessor + description.variable;
+ }
+ else if (reflection is ConstantReflection)
+ {
+ parse = parseConstant;
+ elements = cache.retrieve(target).constant;
+ }
+
+ var members:Array = [];
+
+ for each (var input:XML in elements)
+ {
+ if (reflection.matches(input))
+ members[members.length] = parse(input);
+ }
+
+ return members;
+ }
+
+ private function parseMethod(method:XML):Method
+ {
+ var name:String = method.@name;
+ var parameters:Vector. = new [];
+
+ for each (var parameter:XML in method.parameter)
+ {
+ var type:String = parameter.@type;
+ var index:int = int(parameter.@index);
+ var isOptional:Boolean = parameter.@optional == "true";
+
+ parameters.push(new Parameter(type, index, isOptional));
+ }
+
+ var metadata:Vector. = parseMetadata(method);
+
+ return new Delegate(target, name, parameters, method.@returnType, metadata);
+ }
+
+ private function parseProperty(input:XML):Property
+ {
+ var name:String = input.@name;
+ var type:String = input.@type;
+
+ var metadata:Vector. = parseMetadata(input);
+
+ var isReadable:Boolean = input.localName() == "variable" || input.@access.toString().indexOf("read") >= 0;
+ var isWritable:Boolean = input.localName() == "variable" || input.@access.toString().indexOf("write") >= 0;
+
+ return new Accessor(target, name, type, isReadable, isWritable, metadata);
+ }
+
+ private function parseConstant(input:XML):Constant
+ {
+ var name:String = input.@name;
+ var type:String = input.@type;
+
+ var metadata:Vector. = parseMetadata(input);
+
+ return new Constant(target, name, type, metadata);
+ }
+
+ private function parseMetadata(input:XML):Vector.
+ {
+ var metadata:Vector. = new [];
+
+ for each (var meta:XML in input.metadata)
+ {
+ var properties:Vector. = new [];
+
+ for each (var property:XML in meta.arg)
+ {
+ properties.push(new MetadataProperty(property.@key, property.@value));
+ }
+
+ metadata.push(new Metadata(meta.@name, properties));
+ }
+
+ return metadata;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/metadata/Metadata.as b/src/se/stade/daffodil/metadata/Metadata.as
new file mode 100644
index 0000000..5c9de3f
--- /dev/null
+++ b/src/se/stade/daffodil/metadata/Metadata.as
@@ -0,0 +1,23 @@
+package se.stade.daffodil.metadata
+{
+ public final class Metadata
+ {
+ public function Metadata(name:String, properties:Vector. = null)
+ {
+ _name = name;
+ _properties = properties || new Vector.;
+ }
+
+ private var _name:String;
+ public function get name():String
+ {
+ return _name;
+ }
+
+ private var _properties:Vector.;
+ public function get properties():Vector.
+ {
+ return _properties;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/metadata/MetadataProperty.as b/src/se/stade/daffodil/metadata/MetadataProperty.as
new file mode 100644
index 0000000..69ceee4
--- /dev/null
+++ b/src/se/stade/daffodil/metadata/MetadataProperty.as
@@ -0,0 +1,23 @@
+package se.stade.daffodil.metadata
+{
+ public final class MetadataProperty
+ {
+ public function MetadataProperty(name:String, value:String)
+ {
+ _name = name;
+ _value = value;
+ }
+
+ private var _name:String;
+ public function get name():String
+ {
+ return _name;
+ }
+
+ private var _value:String;
+ public function get value():String
+ {
+ return _value;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/AbstractMethod.as b/src/se/stade/daffodil/methods/AbstractMethod.as
new file mode 100644
index 0000000..9d4ad0a
--- /dev/null
+++ b/src/se/stade/daffodil/methods/AbstractMethod.as
@@ -0,0 +1,44 @@
+package se.stade.daffodil.methods
+{
+ import se.stade.daffodil.TypeMember;
+ import se.stade.daffodil.metadata.Metadata;
+
+ internal class AbstractMethod implements TypeMember
+ {
+ public function AbstractMethod(name:String, type:String, parameters:Vector. = null, metadata:Vector. = null)
+ {
+ _name = name;
+ _type = type;
+
+ _parameters = parameters || new Vector.;
+ _parameters.fixed = true;
+
+ _metadata = metadata || new Vector.;
+ _metadata.fixed = true;
+ }
+
+ private var _name:String;
+ public function get name():String
+ {
+ return _name;
+ }
+
+ private var _type:String;
+ public function get type():String
+ {
+ return _type;
+ }
+
+ private var _parameters:Vector.;
+ public function get parameters():Vector.
+ {
+ return _parameters;
+ }
+
+ private var _metadata:Vector.;
+ public function get metadata():Vector.
+ {
+ return _metadata;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/Constructor.as b/src/se/stade/daffodil/methods/Constructor.as
new file mode 100644
index 0000000..033aaa8
--- /dev/null
+++ b/src/se/stade/daffodil/methods/Constructor.as
@@ -0,0 +1,56 @@
+package se.stade.daffodil.methods
+{
+ import flash.errors.IllegalOperationError;
+ import flash.utils.getQualifiedClassName;
+
+ import se.stade.daffodil.metadata.Metadata;
+
+ public final class Constructor extends AbstractMethod implements Method
+ {
+ public function Constructor(type:Class, parameters:Vector. = null, metadata:Vector. = null)
+ {
+ var qName:String = getQualifiedClassName(type);
+ var name:String = qName.substr(qName.lastIndexOf("::") + 1);
+
+ super(name, qName, parameters, metadata);
+
+ Definition = type;
+ }
+
+ private var Definition:Class;
+
+ public function invoke(... parameters):*
+ {
+ // TODO: Figure out a way to dynamically call a constructor with a variable parameterlist. This is fugly!
+ if (parameters.length == 0)
+ return new Definition();
+ else if (parameters.length == 1)
+ return new Definition(parameters[0]);
+ else if (parameters.length == 2)
+ return new Definition(parameters[0], parameters[1]);
+ else if (parameters.length == 3)
+ return new Definition(parameters[0], parameters[1], parameters[2]);
+ else if (parameters.length == 4)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3]);
+ else if (parameters.length == 5)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]);
+ else if (parameters.length == 6)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5]);
+ else if (parameters.length == 7)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6]);
+ else if (parameters.length == 8)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6], parameters[7]);
+ else if (parameters.length == 9)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6], parameters[7], parameters[8]);
+ else if (parameters.length == 10)
+ return new Definition(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6], parameters[7], parameters[8], parameters[9]);
+ else
+ throw new IllegalOperationError("I'm sorry, I can't handle more than 10 parameters. To be honest, if your class has 10 constructor parameters, it kind of smells.");
+ }
+
+ public function toString():String
+ {
+ return "[Class " + name + "(" + parameters.join(", ") + ")]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/Delegate.as b/src/se/stade/daffodil/methods/Delegate.as
new file mode 100644
index 0000000..856146b
--- /dev/null
+++ b/src/se/stade/daffodil/methods/Delegate.as
@@ -0,0 +1,33 @@
+package se.stade.daffodil.methods
+{
+ import flash.errors.IllegalOperationError;
+
+ import se.stade.daffodil.metadata.Metadata;
+
+ public final class Delegate extends AbstractMethod implements Method
+ {
+ public function Delegate(owner:Object, name:String, parameters:Vector., type:String, metadata:Vector.)
+ {
+ super(name, type, parameters, metadata);
+ this.owner = owner;
+ }
+
+ private var owner:Object;
+
+ public function invoke(... parameters):*
+ {
+ if (name in owner == false)
+ throw new IllegalOperationError("Method not found on owner");
+ else if (owner[name] is Function == false)
+ throw new IllegalOperationError("Member '" + name + "' on owner is not a Function");
+
+ var delegate:Function = owner[name] as Function;
+ return delegate.apply(owner, parameters);
+ }
+
+ public function toString():String
+ {
+ return "[Function " + name + "(" + parameters.join(", ") + ")]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/Method.as b/src/se/stade/daffodil/methods/Method.as
new file mode 100644
index 0000000..79ee34b
--- /dev/null
+++ b/src/se/stade/daffodil/methods/Method.as
@@ -0,0 +1,11 @@
+package se.stade.daffodil.methods
+{
+ import se.stade.daffodil.TypeMember;
+
+ public interface Method extends TypeMember
+ {
+ function get parameters():Vector.;
+
+ function invoke(... parameters):*;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/MethodReflection.as b/src/se/stade/daffodil/methods/MethodReflection.as
new file mode 100644
index 0000000..b933473
--- /dev/null
+++ b/src/se/stade/daffodil/methods/MethodReflection.as
@@ -0,0 +1,23 @@
+package se.stade.daffodil.methods
+{
+ import se.stade.daffodil.Reflection;
+
+ public interface MethodReflection extends Reflection
+ {
+ function named(name:String):MethodReflection;
+
+ function withMetadata(name:String):MethodReflection;
+
+ function get withArguments():MethodReflection;
+
+ function get withoutArguments():MethodReflection;
+
+ function get withOnlyOptionalArguments():MethodReflection;
+
+ function withArgumentCount(count:uint):MethodReflection;
+
+ function withSignature(type:Class, ... types):MethodReflection;
+
+ function withReturnType(type:Class):MethodReflection;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/methods/Parameter.as b/src/se/stade/daffodil/methods/Parameter.as
new file mode 100644
index 0000000..7306f2b
--- /dev/null
+++ b/src/se/stade/daffodil/methods/Parameter.as
@@ -0,0 +1,35 @@
+package se.stade.daffodil.methods
+{
+ public final class Parameter
+ {
+ public function Parameter(type:String, index:int, isOptional:Boolean)
+ {
+ _type = type;
+ _index = index;
+ _isOptional = isOptional;
+ }
+
+ private var _type:String;
+ public function get type():String
+ {
+ return _type;
+ }
+
+ private var _index:int;
+ public function get index():int
+ {
+ return _index;
+ }
+
+ private var _isOptional:Boolean;
+ public function get isOptional():Boolean
+ {
+ return _isOptional;
+ }
+
+ public function toString():String
+ {
+ return type.substr(type.lastIndexOf(":") + 1) + (isOptional ? "?" : "");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/AbstractProperty.as b/src/se/stade/daffodil/properties/AbstractProperty.as
new file mode 100644
index 0000000..e26479e
--- /dev/null
+++ b/src/se/stade/daffodil/properties/AbstractProperty.as
@@ -0,0 +1,43 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.TypeMember;
+ import se.stade.daffodil.metadata.Metadata;
+
+ internal class AbstractProperty implements TypeMember
+ {
+ public function AbstractProperty(owner:Object, name:String, type:String, metadata:Vector.)
+ {
+ this.owner = owner;
+
+ _name = name;
+ _type = type;
+
+ _metadata = metadata || new Vector.;
+ }
+
+ protected var owner:Object;
+
+ private var _name:String;
+ public function get name():String
+ {
+ return _name;
+ }
+
+ private var _type:String;
+ public function get type():String
+ {
+ return _type;
+ }
+
+ public function get value():*
+ {
+ return owner[name];
+ }
+
+ private var _metadata:Vector.;
+ public function get metadata():Vector.
+ {
+ return _metadata;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/Accessor.as b/src/se/stade/daffodil/properties/Accessor.as
new file mode 100644
index 0000000..e010da0
--- /dev/null
+++ b/src/se/stade/daffodil/properties/Accessor.as
@@ -0,0 +1,42 @@
+package se.stade.daffodil.properties
+{
+ import flash.errors.IllegalOperationError;
+
+ import se.stade.daffodil.metadata.Metadata;
+
+ public final class Accessor extends AbstractProperty implements Property
+ {
+ public function Accessor(owner:Object, name:String, type:String, isReadable:Boolean, isWritable:Boolean, metadata:Vector.)
+ {
+ super(owner, name, type, metadata);
+
+ _isReadable = isReadable;
+ _isWritable = isWritable;
+ }
+
+ public function set value(newValue:*):void
+ {
+ if (isWritable)
+ owner[name] = newValue;
+ else
+ throw new IllegalOperationError("Property is not writable");
+ }
+
+ private var _isReadable:Boolean;
+ public function get isReadable():Boolean
+ {
+ return _isReadable;
+ }
+
+ private var _isWritable:Boolean;
+ public function get isWritable():Boolean
+ {
+ return _isWritable;
+ }
+
+ public function toString():String
+ {
+ return "[Property " + name + "]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/Constant.as b/src/se/stade/daffodil/properties/Constant.as
new file mode 100644
index 0000000..4b1dbb7
--- /dev/null
+++ b/src/se/stade/daffodil/properties/Constant.as
@@ -0,0 +1,17 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.metadata.Metadata;
+
+ public final class Constant extends AbstractProperty
+ {
+ public function Constant(owner:Object, name:String, type:String, metadata:Vector.)
+ {
+ super(owner, name, type, metadata);
+ }
+
+ public function toString():String
+ {
+ return "[Constant " + name + "]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/ConstantReflection.as b/src/se/stade/daffodil/properties/ConstantReflection.as
new file mode 100644
index 0000000..ef0e098
--- /dev/null
+++ b/src/se/stade/daffodil/properties/ConstantReflection.as
@@ -0,0 +1,11 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.Reflection;
+
+ public interface ConstantReflection extends Reflection
+ {
+ function named(name:String):ConstantReflection;
+ function ofType(type:Class):ConstantReflection;
+ function withMetadata(name:String):ConstantReflection;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/Property.as b/src/se/stade/daffodil/properties/Property.as
new file mode 100644
index 0000000..9f26aff
--- /dev/null
+++ b/src/se/stade/daffodil/properties/Property.as
@@ -0,0 +1,15 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.TypeMember;
+
+ public interface Property extends TypeMember
+ {
+ function get value():*;
+
+ function set value(newValue:*):void;
+
+ function get isReadable():Boolean;
+
+ function get isWritable():Boolean;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/PropertyReflection.as b/src/se/stade/daffodil/properties/PropertyReflection.as
new file mode 100644
index 0000000..ecca477
--- /dev/null
+++ b/src/se/stade/daffodil/properties/PropertyReflection.as
@@ -0,0 +1,14 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.Reflection;
+
+ public interface PropertyReflection extends Reflection
+ {
+ function named(name:String):PropertyReflection;
+ function ofType(type:Class):PropertyReflection;
+ function withMetadata(name:String):PropertyReflection;
+
+ function get thatAreReadable():PropertyReflection;
+ function get thatAreWritable():PropertyReflection;
+ }
+}
\ No newline at end of file
diff --git a/src/se/stade/daffodil/properties/Variable.as b/src/se/stade/daffodil/properties/Variable.as
new file mode 100644
index 0000000..38f5b43
--- /dev/null
+++ b/src/se/stade/daffodil/properties/Variable.as
@@ -0,0 +1,32 @@
+package se.stade.daffodil.properties
+{
+ import se.stade.daffodil.metadata.Metadata;
+
+ public final class Variable extends AbstractProperty implements Property
+ {
+ public function Variable(owner:Object, name:String, type:String, metadata:Vector.)
+ {
+ super(owner, name, type, metadata);
+ }
+
+ public function set value(newValue:*):void
+ {
+ owner[name] = newValue;
+ }
+
+ public function get isReadable():Boolean
+ {
+ return true;
+ }
+
+ public function get isWritable():Boolean
+ {
+ return true;
+ }
+
+ public function toString():String
+ {
+ return "[Variable " + name + "]";
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/Fussy.as b/src/uk/co/ziazoo/fussy/Fussy.as
deleted file mode 100644
index 25bd044..0000000
--- a/src/uk/co/ziazoo/fussy/Fussy.as
+++ /dev/null
@@ -1,54 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import flash.system.ApplicationDomain;
- import flash.system.Capabilities;
-
- import flash.utils.Dictionary;
-
- import uk.co.ziazoo.fussy.parser.AccessorParser;
- import uk.co.ziazoo.fussy.parser.ConstructorParser;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.parser.MetadataParser;
- import uk.co.ziazoo.fussy.parser.MethodParser;
- import uk.co.ziazoo.fussy.parser.ParameterParser;
- import uk.co.ziazoo.fussy.parser.PropertyParser;
- import uk.co.ziazoo.fussy.parser.VariableParser;
- import uk.co.ziazoo.fussy.query.QueryBuilder;
-
- public class Fussy
- {
- private var methodParser:IResultParser;
- private var propertyParser:IResultParser;
- private var constructorParser:IResultParser;
- private var metadataParser:MetadataParser;
- private var _reflector:IReflector;
-
- public function Fussy(reflector:IReflector = null)
- {
- var parameterParser:ParameterParser = new ParameterParser();
- metadataParser = new MetadataParser();
-
- methodParser = new MethodParser(parameterParser, metadataParser);
- propertyParser = new PropertyParser(
- new VariableParser(metadataParser), new AccessorParser(metadataParser));
-
- constructorParser = new ConstructorParser(parameterParser);
-
- _reflector = reflector;
- }
-
- public function query():QueryBuilder
- {
- return new QueryBuilder(reflector, methodParser,
- propertyParser, constructorParser, metadataParser);
- }
-
- public function get reflector():IReflector
- {
- if (!_reflector) {
- _reflector = new Reflector();
- }
- return _reflector;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/IReflector.as b/src/uk/co/ziazoo/fussy/IReflector.as
deleted file mode 100644
index eeeeaf5..0000000
--- a/src/uk/co/ziazoo/fussy/IReflector.as
+++ /dev/null
@@ -1,48 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import flash.system.ApplicationDomain;
-
- /**
- * stores result of describeType calls
- */
- public interface IReflector
- {
- /**
- * Get reflection for a class
- * @param type the class to reflect
- * @return result of describeType
- */
- function forType(type:Class):XML;
-
- /**
- * Get reflection for a types qualified name
- * @param qName of type to reflect
- * @return result of describeType
- */
- function forQName(qName:String):XML;
-
- /**
- * Release all type description in memory (drop references)
- */
- function clearAll():void;
-
- /**
- * Release specific types description
- * @param type who's description reference can be released
- */
- function clearForType(type:Class):void;
-
- /**
- * Release specific types description
- * @param qName of type who's description reference can be released
- */
- function clearForQName(qName:String):void;
-
- /**
- * The application domain which fussy will request class
- * definitions from
- */
- function get applicationDomain():ApplicationDomain;
- function set applicationDomain(value:ApplicationDomain):void;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/InstanceCreator.as b/src/uk/co/ziazoo/fussy/InstanceCreator.as
deleted file mode 100644
index f031d53..0000000
--- a/src/uk/co/ziazoo/fussy/InstanceCreator.as
+++ /dev/null
@@ -1,41 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- public class InstanceCreator
- {
- public static function create(type:Class, params:Array):Object
- {
- if (!params)
- {
- return new type();
- }
-
- switch (params.length)
- {
- case 0:
- return new type();
- case 1:
- return new type(params[0]);
- case 2:
- return new type(params[0], params[1]);
- case 3:
- return new type(params[0], params[1], params[2]);
- case 4:
- return new type(params[0], params[1], params[2], params[3]);
- case 5:
- return new type(params[0], params[1], params[2], params[3], params[4]);
- case 6:
- return new type(params[0], params[1], params[2], params[3], params[4], params[5]);
- case 7:
- return new type(params[0], params[1], params[2], params[3], params[4], params[5], params[6]);
- case 8:
- return new type(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7]);
- case 9:
- return new type(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8]);
- case 10:
- return new type(params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7], params[8], params[9]);
- }
- return null;
- }
- }
-}
-
diff --git a/src/uk/co/ziazoo/fussy/Reflector.as b/src/uk/co/ziazoo/fussy/Reflector.as
deleted file mode 100644
index 026eac2..0000000
--- a/src/uk/co/ziazoo/fussy/Reflector.as
+++ /dev/null
@@ -1,113 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import flash.system.ApplicationDomain;
- import flash.utils.Dictionary;
- import flash.utils.describeType;
-
- public class Reflector implements IReflector
- {
- private var cache:Dictionary;
- private var _applicationDomain:ApplicationDomain;
-
- public function Reflector(applicationDomain:ApplicationDomain = null)
- {
- cache = new Dictionary();
- _applicationDomain = applicationDomain;
- }
-
- /**
- * @inheritDoc
- */
- public function forType(type:Class):XML
- {
- var description:XML = cache[type] as XML;
-
- if (description)
- {
- return description;
- }
-
- description = describeType(type);
- var constructor:XML = description.factory.constructor[0];
-
- if (constructor &&
- constructor.parameter.(@type == "*").length()
- == constructor.parameter.@type.length())
- {
- var parameters:XMLList = constructor.parameter;
- if (parameters.length() > 0)
- {
- try
- {
- var args:Array = [];
- for (var i:int = 0; i < parameters.length(); i++)
- {
- args.push(null);
- }
- InstanceCreator.create(type, args);
- description = describeType(type);
- }
- catch(error:Error)
- {
- }
- }
- }
-
- cache[type] = description;
- return description;
- }
-
- /**
- * @inheritDoc
- */
- public function forQName(qName:String):XML
- {
- var type:Class = Class(applicationDomain.getDefinition(qName));
- return forType(type);
- }
-
- /**
- * @inheritDoc
- */
- public function clearAll():void
- {
- cache = null;
- cache = new Dictionary();
- }
-
- /**
- * @inheritDoc
- */
- public function clearForType(type:Class):void
- {
- if (cache[type])
- {
- delete cache[type];
- }
- }
-
- /**
- * @inheritDoc
- */
- public function clearForQName(qName:String):void
- {
- var type:Class = Class(applicationDomain.getDefinition(qName));
- clearForType(type);
- }
-
- public function hasReflection(type:Class):Boolean
- {
- return cache[type] != null;
- }
-
- public function get applicationDomain():ApplicationDomain
- {
- return _applicationDomain || ApplicationDomain.currentDomain;
- }
-
- public function set applicationDomain(value:ApplicationDomain):void
- {
- _applicationDomain = value;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/TypeDescription.as b/src/uk/co/ziazoo/fussy/TypeDescription.as
deleted file mode 100644
index 6bad2ee..0000000
--- a/src/uk/co/ziazoo/fussy/TypeDescription.as
+++ /dev/null
@@ -1,67 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import uk.co.ziazoo.fussy.model.Constructor;
-
- /**
- * Provides basic information about a class
- */
- public class TypeDescription
- {
- private var _qName:String;
- private var _isDynamic:Boolean;
- private var _isFinal:Boolean;
- private var _constructor:Constructor;
- private var _metadata:Array;
-
- public function TypeDescription(qName:String,
- isDynamic:Boolean, isFinal:Boolean, constructor:Constructor,
- metadata:Array)
- {
- _qName = qName;
- _isDynamic = isDynamic;
- _isFinal = isFinal;
- _constructor = constructor;
- _metadata = metadata;
- }
-
- /**
- * The fully qualified of a class
- */
- public function get qName():String
- {
- return _qName;
- }
-
- /**
- * Is this a class that describes a dynamic object
- */
- public function get isDynamic():Boolean
- {
- return _isDynamic;
- }
-
- /**
- * Is this a class that describes a final object
- */
- public function get isFinal():Boolean
- {
- return _isFinal;
- }
-
- /**
- * The constructor for this object
- */
- public function get constructor():Constructor
- {
- return _constructor;
- }
-
- /**
- * Any class level meta data for this class
- */
- public function get metadata():Array
- {
- return _metadata;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/AccessorQueryChain.as b/src/uk/co/ziazoo/fussy/accessors/AccessorQueryChain.as
deleted file mode 100644
index 450601f..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/AccessorQueryChain.as
+++ /dev/null
@@ -1,50 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.properties.PropertyQueryChain;
-
- public class AccessorQueryChain extends PropertyQueryChain
- {
- public function AccessorQueryChain(reflector:IReflector,
- parser:IResultParser)
- {
- super(reflector, parser);
- }
-
- override protected function getList(reflection:XML):XMLList
- {
- return reflection.factory.accessor;
- }
-
- public function readable():AccessorQueryChain
- {
- parts.push(new Readable());
- return this;
- }
-
- public function writable():AccessorQueryChain
- {
- parts.push(new Writable());
- return this;
- }
-
- public function readOnly():AccessorQueryChain
- {
- parts.push(new ReadOnly());
- return this;
- }
-
- public function writeOnly():AccessorQueryChain
- {
- parts.push(new WriteOnly());
- return this;
- }
-
- public function readAndWrite():AccessorQueryChain
- {
- parts.push(new ReadAndWrite());
- return this;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/ReadAndWrite.as b/src/uk/co/ziazoo/fussy/accessors/ReadAndWrite.as
deleted file mode 100644
index edf0053..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/ReadAndWrite.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class ReadAndWrite implements IQueryPart
- {
- public function ReadAndWrite()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @access == "readwrite"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/ReadOnly.as b/src/uk/co/ziazoo/fussy/accessors/ReadOnly.as
deleted file mode 100644
index f9f45ef..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/ReadOnly.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class ReadOnly implements IQueryPart
- {
- public function ReadOnly()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @access == "readonly"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/Readable.as b/src/uk/co/ziazoo/fussy/accessors/Readable.as
deleted file mode 100644
index b314663..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/Readable.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class Readable implements IQueryPart
- {
- public function Readable()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @access == "readwrite" || @access == "readonly"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/Writable.as b/src/uk/co/ziazoo/fussy/accessors/Writable.as
deleted file mode 100644
index 1f3248c..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/Writable.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class Writable implements IQueryPart
- {
- public function Writable()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @access == "readwrite" || @access == "writeonly"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/accessors/WriteOnly.as b/src/uk/co/ziazoo/fussy/accessors/WriteOnly.as
deleted file mode 100644
index 07d1154..0000000
--- a/src/uk/co/ziazoo/fussy/accessors/WriteOnly.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class WriteOnly implements IQueryPart
- {
- public function WriteOnly()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @access == "writeonly"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/ArgumentsLengthOf.as b/src/uk/co/ziazoo/fussy/methods/ArgumentsLengthOf.as
deleted file mode 100644
index 9c36c84..0000000
--- a/src/uk/co/ziazoo/fussy/methods/ArgumentsLengthOf.as
+++ /dev/null
@@ -1,21 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class ArgumentsLengthOf implements IQueryPart
- {
- private var count:int;
-
- public function ArgumentsLengthOf(count:int)
- {
- this.count = count;
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- hasOwnProperty("parameter") && parameter.length() == count
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/HasTypeSignature.as b/src/uk/co/ziazoo/fussy/methods/HasTypeSignature.as
deleted file mode 100644
index 3b24737..0000000
--- a/src/uk/co/ziazoo/fussy/methods/HasTypeSignature.as
+++ /dev/null
@@ -1,53 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import flash.utils.getQualifiedClassName;
-
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class HasTypeSignature implements IQueryPart
- {
- private var types:Array;
-
- public function HasTypeSignature(types:Array)
- {
- this.types = types;
- }
-
- public function filter(data:XMLList):XMLList
- {
- var filtered:XMLList = new XMLList();
-
- for each(var method:XML in data)
- {
- var parameters:XMLList = method.parameter;
-
- if (lengthIsCorrect(parameters)
- && typesAreCorrect(parameters))
- {
- filtered.appendChild(method);
- }
- }
- return filtered.method;
- }
-
- private function lengthIsCorrect(parameters:XMLList):Boolean
- {
- return types.length == parameters.length();
- }
-
- private function typesAreCorrect(parameters:XMLList):Boolean
- {
- for each(var parameter:XML in parameters)
- {
- var type:Class = types[Number(parameter.@index) - 1] as Class;
- var qName:String = getQualifiedClassName(type);
- if (parameter.@type != qName)
- {
- return false;
- }
- }
-
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/MethodQueryChain.as b/src/uk/co/ziazoo/fussy/methods/MethodQueryChain.as
deleted file mode 100644
index 415bcf0..0000000
--- a/src/uk/co/ziazoo/fussy/methods/MethodQueryChain.as
+++ /dev/null
@@ -1,101 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.query.AbstractQueryChain;
- import uk.co.ziazoo.fussy.query.Named;
- import uk.co.ziazoo.fussy.query.WithMetadata;
-
- public class MethodQueryChain extends AbstractQueryChain
- {
- public function MethodQueryChain(reflector:IReflector, parser:IResultParser)
- {
- super(reflector, parser);
- }
-
- override protected function getList(reflection:XML):XMLList
- {
- return reflection.factory.method;
- }
-
- /**
- * Filters based on the method name
- * @param name of method
- * @return MethodQueryChain to allow query DSL
- */
- public function named(name:String):MethodQueryChain
- {
- parts.push(new Named(name));
- return this;
- }
-
- /**
- * Allows filtering by the type signature of the arguments
- * e.g. hasTypeSignature(String,int,Array) would return all the
- * methods which take a string, followed by a int then an array as
- * their argument list
- *
- * @param types the classes of the arguments
- * @return MethodQueryChain to allow query DSL
- */
- public function withTypeSignature(...types):MethodQueryChain
- {
- parts.push(new HasTypeSignature(types));
- return this;
- }
-
- /**
- * Filters by the number of arguements the method takes
- * @param count number of arguments the method has in its signature
- * @return MethodQueryChain to allow query DSL
- */
- public function withArgsLengthOf(count:int):MethodQueryChain
- {
- parts.push(new ArgumentsLengthOf(count));
- return this;
- }
-
- /**
- * Filters by metadata name
- * @param named the name of the metadata a method must have to pass through
- * this filter
- * @return MethodQueryChain to allow query DSL
- */
- public function withMetadata(named:String):MethodQueryChain
- {
- parts.push(new WithMetadata(named));
- return this;
- }
-
- /**
- * To find methods that take not arguments
- * @return MethodQueryChain to allow query DSL
- */
- public function noArguments():MethodQueryChain
- {
- parts.push(new NoArgs());
- return this;
- }
-
- /**
- * To find methods that have no arguments that must be provided. Methods
- * with many arguments that have default values can pass this filter
- * @return MethodQueryChain to allow query DSL
- */
- public function noCompulsoryArguments():MethodQueryChain
- {
- parts.push(new NoCompulsoryArgs());
- return this;
- }
-
- /**
- * To find methods that have one or more arguments
- * @return MethodQueryChain to allow query DSL
- */
- public function withArguments():MethodQueryChain
- {
- parts.push(new WithArguments());
- return this;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/NoArgs.as b/src/uk/co/ziazoo/fussy/methods/NoArgs.as
deleted file mode 100644
index 32dc1ab..0000000
--- a/src/uk/co/ziazoo/fussy/methods/NoArgs.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class NoArgs implements IQueryPart
- {
- public function NoArgs()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- !hasOwnProperty("parameter")
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/NoCompulsoryArgs.as b/src/uk/co/ziazoo/fussy/methods/NoCompulsoryArgs.as
deleted file mode 100644
index fcd1ccf..0000000
--- a/src/uk/co/ziazoo/fussy/methods/NoCompulsoryArgs.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class NoCompulsoryArgs implements IQueryPart
- {
- public function NoCompulsoryArgs()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- !hasOwnProperty("parameter") || parameter.@optional == "true"
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/methods/WithArguments.as b/src/uk/co/ziazoo/fussy/methods/WithArguments.as
deleted file mode 100644
index 41cdbf0..0000000
--- a/src/uk/co/ziazoo/fussy/methods/WithArguments.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class WithArguments implements IQueryPart
- {
- public function WithArguments()
- {
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- hasOwnProperty("parameter")
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Accessor.as b/src/uk/co/ziazoo/fussy/model/Accessor.as
deleted file mode 100644
index 9eda123..0000000
--- a/src/uk/co/ziazoo/fussy/model/Accessor.as
+++ /dev/null
@@ -1,12 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Accessor extends Property
- {
- public var access:String;
- public var declaredBy:String;
-
- public function Accessor()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Constructor.as b/src/uk/co/ziazoo/fussy/model/Constructor.as
deleted file mode 100644
index febb8e1..0000000
--- a/src/uk/co/ziazoo/fussy/model/Constructor.as
+++ /dev/null
@@ -1,12 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Constructor
- {
- public var parameters:Array;
-
- public function Constructor()
- {
- }
- }
-}
-
diff --git a/src/uk/co/ziazoo/fussy/model/Metadata.as b/src/uk/co/ziazoo/fussy/model/Metadata.as
deleted file mode 100644
index 86b05f4..0000000
--- a/src/uk/co/ziazoo/fussy/model/Metadata.as
+++ /dev/null
@@ -1,14 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- import flash.utils.Dictionary;
-
- public class Metadata
- {
- public var name:String;
- public var properties:Dictionary;
-
- public function Metadata()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Method.as b/src/uk/co/ziazoo/fussy/model/Method.as
deleted file mode 100644
index 1d350a3..0000000
--- a/src/uk/co/ziazoo/fussy/model/Method.as
+++ /dev/null
@@ -1,19 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Method
- {
- public var name:String;
- public var parameters:Array;
- public var metadata:Array;
-
- public function Method()
- {
- }
-
- public function invoke(instance:Object, args:Array = null):Object
- {
- var fnt:Function = instance[ name ] as Function;
- return fnt.apply(instance, args);
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Parameter.as b/src/uk/co/ziazoo/fussy/model/Parameter.as
deleted file mode 100644
index 2db5d58..0000000
--- a/src/uk/co/ziazoo/fussy/model/Parameter.as
+++ /dev/null
@@ -1,13 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Parameter
- {
- public var index:int;
- public var type:String;
- public var optional:Boolean;
-
- public function Parameter()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Property.as b/src/uk/co/ziazoo/fussy/model/Property.as
deleted file mode 100644
index 96c7994..0000000
--- a/src/uk/co/ziazoo/fussy/model/Property.as
+++ /dev/null
@@ -1,23 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Property
- {
- public var name:String;
- public var type:String;
- public var metadata:Array;
-
- public function Property()
- {
- }
-
- public function setter(instance:Object, arg:Object):void
- {
- instance[name] = arg;
- }
-
- public function getter(instance:Object):Object
- {
- return instance[name];
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/model/Variable.as b/src/uk/co/ziazoo/fussy/model/Variable.as
deleted file mode 100644
index 21dc9c0..0000000
--- a/src/uk/co/ziazoo/fussy/model/Variable.as
+++ /dev/null
@@ -1,9 +0,0 @@
-package uk.co.ziazoo.fussy.model
-{
- public class Variable extends Property
- {
- public function Variable()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/AccessorParser.as b/src/uk/co/ziazoo/fussy/parser/AccessorParser.as
deleted file mode 100644
index 8c48860..0000000
--- a/src/uk/co/ziazoo/fussy/parser/AccessorParser.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.Accessor;
-
- public class AccessorParser implements IResultParser
- {
- private var metadataParser:MetadataParser;
-
- public function AccessorParser(metadataParser:MetadataParser)
- {
- this.metadataParser = metadataParser;
- }
-
- public function parse(result:XMLList):Array
- {
- var accessors:Array = [];
- for each(var xml:XML in result)
- {
- accessors.push(parseAccessor(xml));
- }
- return accessors;
- }
-
- private function parseAccessor(reflection:XML):Accessor
- {
- var property:Accessor = new Accessor();
- property.name = reflection.@name;
- property.type = reflection.@type;
- property.declaredBy = reflection.@declaredBy;
- property.access = reflection.@access;
- property.metadata = metadataParser.parse(reflection.metadata);
- return property;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/ConstructorParser.as b/src/uk/co/ziazoo/fussy/parser/ConstructorParser.as
deleted file mode 100644
index a801238..0000000
--- a/src/uk/co/ziazoo/fussy/parser/ConstructorParser.as
+++ /dev/null
@@ -1,21 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.Constructor;
-
- public class ConstructorParser implements IResultParser
- {
- private var parameterParser:ParameterParser;
-
- public function ConstructorParser(parameterParser:ParameterParser)
- {
- this.parameterParser = parameterParser;
- }
-
- public function parse(result:XMLList):Array
- {
- var constructor:Constructor = new Constructor();
- constructor.parameters = parameterParser.parse(result.constructor.parameter);
- return [constructor];
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/IResultParser.as b/src/uk/co/ziazoo/fussy/parser/IResultParser.as
deleted file mode 100644
index b91bfd7..0000000
--- a/src/uk/co/ziazoo/fussy/parser/IResultParser.as
+++ /dev/null
@@ -1,7 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- public interface IResultParser
- {
- function parse(result:XMLList):Array;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/MetadataParser.as b/src/uk/co/ziazoo/fussy/parser/MetadataParser.as
deleted file mode 100644
index c813df1..0000000
--- a/src/uk/co/ziazoo/fussy/parser/MetadataParser.as
+++ /dev/null
@@ -1,37 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import flash.utils.Dictionary;
-
- import uk.co.ziazoo.fussy.model.Metadata;
-
- public class MetadataParser implements IResultParser
- {
- public function MetadataParser()
- {
- super();
- }
-
- public function parse(result:XMLList):Array
- {
- var metadata:Array = [];
- for each(var m:XML in result)
- {
- metadata.push(parseMetadata(m));
- }
- return metadata;
- }
-
- public function parseMetadata(reflection:XML):Metadata
- {
- var metadata:Metadata = new Metadata();
- metadata.name = reflection.@name;
- metadata.properties = new Dictionary();
-
- for each(var p:XML in reflection.arg)
- {
- metadata.properties[String(p.@key)] = String(p.@value);
- }
- return metadata;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/MethodParser.as b/src/uk/co/ziazoo/fussy/parser/MethodParser.as
deleted file mode 100644
index c976e18..0000000
--- a/src/uk/co/ziazoo/fussy/parser/MethodParser.as
+++ /dev/null
@@ -1,36 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.Method;
-
- public class MethodParser implements IResultParser
- {
- private var parameterParser:ParameterParser;
- private var metadataParser:MetadataParser;
-
- public function MethodParser(parameterParser:ParameterParser,
- metadataParser:MetadataParser)
- {
- this.parameterParser = parameterParser;
- this.metadataParser = metadataParser;
- }
-
- public function parse(result:XMLList):Array
- {
- var methods:Array = [];
- for each(var method:XML in result)
- {
- methods.push(parseMethod(method));
- }
- return methods;
- }
-
- public function parseMethod(reflection:XML):Method
- {
- var method:Method = new Method();
- method.name = reflection.@name;
- method.parameters = parameterParser.parse(reflection.parameter);
- method.metadata = metadataParser.parse(reflection.metadata);
- return method;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/ParameterParser.as b/src/uk/co/ziazoo/fussy/parser/ParameterParser.as
deleted file mode 100644
index 67411ce..0000000
--- a/src/uk/co/ziazoo/fussy/parser/ParameterParser.as
+++ /dev/null
@@ -1,32 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.Parameter;
-
- public class ParameterParser implements IResultParser
- {
- public function ParameterParser()
- {
- super();
- }
-
-
- public function parse(result:XMLList):Array
- {
- var params:Array = [];
- for each(var param:XML in result)
- {
- params.push(parseParameter(param));
- }
- return params;
- }
-
- public function parseParameter(reflection:XML):Parameter
- {
- var parameter:Parameter = new Parameter();
- parameter.index = parseInt(reflection.@index);
- parameter.type = reflection.@type;
- parameter.optional = reflection.@optional == "true";
- return parameter;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/PropertyParser.as b/src/uk/co/ziazoo/fussy/parser/PropertyParser.as
deleted file mode 100644
index f61bd23..0000000
--- a/src/uk/co/ziazoo/fussy/parser/PropertyParser.as
+++ /dev/null
@@ -1,27 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- public class PropertyParser implements IResultParser
- {
- private var variableParser:VariableParser;
- private var accessorParser:AccessorParser;
-
- public function PropertyParser(variableParser:VariableParser,
- accessorParser:AccessorParser)
- {
- this.variableParser = variableParser;
- this.accessorParser = accessorParser;
- }
-
- public function parse(result:XMLList):Array
- {
- var root:XML = ;
- root.appendChild(result);
-
- var accessors:Array = accessorParser.parse(root.accessor);
- var variables:Array = variableParser.parse(root.variable);
-
- var properties:Array = accessors.concat(variables);
- return properties;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/parser/VariableParser.as b/src/uk/co/ziazoo/fussy/parser/VariableParser.as
deleted file mode 100644
index 6355c7b..0000000
--- a/src/uk/co/ziazoo/fussy/parser/VariableParser.as
+++ /dev/null
@@ -1,33 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.Variable;
-
- public class VariableParser implements IResultParser
- {
- private var metadataParser:MetadataParser;
-
- public function VariableParser(metadataParser:MetadataParser)
- {
- this.metadataParser = metadataParser;
- }
-
- public function parse(result:XMLList):Array
- {
- var variables:Array = [];
- for each(var xml:XML in result)
- {
- variables.push(parseVariable(xml));
- }
- return variables;
- }
-
- private function parseVariable(reflection:XML):Variable
- {
- var property:Variable = new Variable();
- property.name = reflection.@name;
- property.type = reflection.@type;
- property.metadata = metadataParser.parse(reflection.metadata);
- return property;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/properties/OfType.as b/src/uk/co/ziazoo/fussy/properties/OfType.as
deleted file mode 100644
index 5ce763b..0000000
--- a/src/uk/co/ziazoo/fussy/properties/OfType.as
+++ /dev/null
@@ -1,23 +0,0 @@
-package uk.co.ziazoo.fussy.properties
-{
- import flash.utils.getQualifiedClassName;
-
- import uk.co.ziazoo.fussy.query.IQueryPart;
-
- public class OfType implements IQueryPart
- {
- private var type:Class;
-
- public function OfType(type:Class)
- {
- this.type = type;
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(
- @type == getQualifiedClassName(type)
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/properties/PropertyQueryChain.as b/src/uk/co/ziazoo/fussy/properties/PropertyQueryChain.as
deleted file mode 100644
index 9cbce03..0000000
--- a/src/uk/co/ziazoo/fussy/properties/PropertyQueryChain.as
+++ /dev/null
@@ -1,37 +0,0 @@
-package uk.co.ziazoo.fussy.properties
-{
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.query.AbstractQueryChain;
- import uk.co.ziazoo.fussy.query.WithMetadata;
-
- public class PropertyQueryChain extends AbstractQueryChain
- {
- public function PropertyQueryChain(reflector:IReflector, parser:IResultParser)
- {
- super(reflector, parser);
- }
-
- // TODO: allow readable/writable queries on properties
-
- override protected function getList(reflection:XML):XMLList
- {
- var p:XMLList = new XMLList();
- p.appendChild(reflection.factory.variable);
- p.appendChild(reflection.factory.accessor);
- return p.*;
- }
-
- public function ofType(type:Class):PropertyQueryChain
- {
- parts.push(new OfType(type));
- return this;
- }
-
- public function withMetadata(name:String):PropertyQueryChain
- {
- parts.push(new WithMetadata(name));
- return this;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/AbstractQueryChain.as b/src/uk/co/ziazoo/fussy/query/AbstractQueryChain.as
deleted file mode 100644
index 9491b79..0000000
--- a/src/uk/co/ziazoo/fussy/query/AbstractQueryChain.as
+++ /dev/null
@@ -1,76 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import flash.utils.describeType;
-
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.parser.IResultParser;
-
- public class AbstractQueryChain implements IQueryChain
- {
- /**
- * @private
- */
- protected var parts:Array;
-
- /**
- * @private
- */
- protected var reflector:IReflector;
-
- private var _parser:IResultParser;
-
-
- public function AbstractQueryChain(reflector:IReflector, parser:IResultParser)
- {
- parts = [];
- _parser = parser;
- this.reflector = reflector;
- }
-
- public function forType(type:Class):Array
- {
- return parser.parse(xmlForType(type));
- }
-
- public function xmlForType(type:Class):XMLList
- {
- if (parts.length == 0)
- {
- return null;
- }
-
- var firstPart:IQueryPart = parts[0];
- var lastResult:XMLList = firstPart.filter(getList(reflector.forType(type)));
-
- var i:int = parts.length - 1;
-
- while (i >= 0)
- {
- var part:IQueryPart = parts[i];
- lastResult = part.filter(lastResult);
- i--;
- }
- return lastResult;
- }
-
- protected function getList(reflection:XML):XMLList
- {
- return null;
- }
-
- public function get parser():IResultParser
- {
- return _parser;
- }
-
- public function set parser(value:IResultParser):void
- {
- _parser = value;
- }
-
- public function addQueryPart(part:IQueryPart):void
- {
- parts.push(part);
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/IQuery.as b/src/uk/co/ziazoo/fussy/query/IQuery.as
deleted file mode 100644
index 036243c..0000000
--- a/src/uk/co/ziazoo/fussy/query/IQuery.as
+++ /dev/null
@@ -1,7 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- public interface IQuery
- {
- function forType(type:Class):Array;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/IQueryBuilder.as b/src/uk/co/ziazoo/fussy/query/IQueryBuilder.as
deleted file mode 100644
index 162ffc2..0000000
--- a/src/uk/co/ziazoo/fussy/query/IQueryBuilder.as
+++ /dev/null
@@ -1,20 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import uk.co.ziazoo.fussy.accessors.AccessorQueryChain;
- import uk.co.ziazoo.fussy.methods.MethodQueryChain;
- import uk.co.ziazoo.fussy.properties.PropertyQueryChain;
- import uk.co.ziazoo.fussy.variables.VariableQueryChain;
-
- public interface IQueryBuilder
- {
- function getTypeQuery():ITypeQuery;
-
- function findMethods():MethodQueryChain;
-
- function findProperties():PropertyQueryChain;
-
- function findAccessors():AccessorQueryChain;
-
- function findVariables():VariableQueryChain;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/IQueryChain.as b/src/uk/co/ziazoo/fussy/query/IQueryChain.as
deleted file mode 100644
index 05d80c7..0000000
--- a/src/uk/co/ziazoo/fussy/query/IQueryChain.as
+++ /dev/null
@@ -1,13 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import uk.co.ziazoo.fussy.parser.IResultParser;
-
- public interface IQueryChain extends IQuery
- {
- function addQueryPart(part:IQueryPart):void;
-
- function get parser():IResultParser;
-
- function set parser(value:IResultParser):void;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/IQueryPart.as b/src/uk/co/ziazoo/fussy/query/IQueryPart.as
deleted file mode 100644
index fe89d9f..0000000
--- a/src/uk/co/ziazoo/fussy/query/IQueryPart.as
+++ /dev/null
@@ -1,7 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- public interface IQueryPart
- {
- function filter(data:XMLList):XMLList;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/ITypeQuery.as b/src/uk/co/ziazoo/fussy/query/ITypeQuery.as
deleted file mode 100644
index b48240a..0000000
--- a/src/uk/co/ziazoo/fussy/query/ITypeQuery.as
+++ /dev/null
@@ -1,11 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import uk.co.ziazoo.fussy.TypeDescription;
-
- public interface ITypeQuery
- {
- function forType(type:Class):TypeDescription;
-
- function forQName(qName:String):TypeDescription;
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/Named.as b/src/uk/co/ziazoo/fussy/query/Named.as
deleted file mode 100644
index 14a467d..0000000
--- a/src/uk/co/ziazoo/fussy/query/Named.as
+++ /dev/null
@@ -1,18 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
-
- public class Named implements IQueryPart
- {
- private var name:String;
-
- public function Named(name:String)
- {
- this.name = name;
- }
-
- public function filter(data:XMLList):XMLList
- {
- return data.(@name == name);
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/QueryBuilder.as b/src/uk/co/ziazoo/fussy/query/QueryBuilder.as
deleted file mode 100644
index abb1098..0000000
--- a/src/uk/co/ziazoo/fussy/query/QueryBuilder.as
+++ /dev/null
@@ -1,54 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.accessors.AccessorQueryChain;
- import uk.co.ziazoo.fussy.methods.MethodQueryChain;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.properties.PropertyQueryChain;
- import uk.co.ziazoo.fussy.variables.VariableQueryChain;
-
- public class QueryBuilder implements IQueryBuilder
- {
- private var methodParser:IResultParser;
- private var propertyParser:IResultParser;
- private var constructorParser:IResultParser;
- private var metadataParser:IResultParser;
- private var reflector:IReflector;
-
- public function QueryBuilder(reflector:IReflector, methodParser:IResultParser,
- propertyParser:IResultParser, constructorParser:IResultParser,
- metadataParser:IResultParser)
- {
- this.propertyParser = propertyParser;
- this.methodParser = methodParser;
- this.constructorParser = constructorParser;
- this.metadataParser = metadataParser;
- this.reflector = reflector;
- }
-
- public function getTypeQuery():ITypeQuery
- {
- return new TypeQuery(reflector, constructorParser, metadataParser);
- }
-
- public function findMethods():MethodQueryChain
- {
- return new MethodQueryChain(reflector, methodParser);
- }
-
- public function findProperties():PropertyQueryChain
- {
- return new PropertyQueryChain(reflector, propertyParser);
- }
-
- public function findAccessors():AccessorQueryChain
- {
- return new AccessorQueryChain(reflector, propertyParser);
- }
-
- public function findVariables():VariableQueryChain
- {
- return new VariableQueryChain(reflector, propertyParser);
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/TypeQuery.as b/src/uk/co/ziazoo/fussy/query/TypeQuery.as
deleted file mode 100644
index 5140d78..0000000
--- a/src/uk/co/ziazoo/fussy/query/TypeQuery.as
+++ /dev/null
@@ -1,86 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import flash.utils.Dictionary;
-
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.TypeDescription;
- import uk.co.ziazoo.fussy.model.Constructor;
- import uk.co.ziazoo.fussy.parser.IResultParser;
-
- public class TypeQuery implements ITypeQuery
- {
- private var reflector:IReflector;
- private var constructorParser:IResultParser;
- private var metadataParser:IResultParser;
- private var cache:Dictionary;
-
- public function TypeQuery(reflector:IReflector,
- constructorParser:IResultParser, metadataParser:IResultParser)
- {
- this.reflector = reflector;
- this.constructorParser = constructorParser;
- this.metadataParser = metadataParser;
- this.cache = new Dictionary();
- }
-
- public function forType(type:Class):TypeDescription
- {
- var description:TypeDescription = cache[type] as TypeDescription;
-
- if (description)
- {
- return description;
- }
- var reflection:XML = reflector.forType(type);
-
- description = new TypeDescription
- (
- getQName(reflection),
- getIsDynamic(reflection),
- getIsFinal(reflection),
- getConstructor(reflection),
- getMetadata(reflection)
- );
-
- cache[type] = description;
- return description;
- }
-
- public function forQName(qName:String):TypeDescription
- {
- return forType(Class(reflector.applicationDomain.getDefinition(qName)));
- }
-
- private function getQName(reflection:XML):String
- {
- return reflection.@name;
- }
-
- private function getIsDynamic(reflection:XML):Boolean
- {
- return String(reflection.@isDynamic) == "true";
- }
-
- private function getIsFinal(reflection:XML):Boolean
- {
- return String(reflection.@isFinal) == "true";
- }
-
- private function getConstructor(reflection:XML):Constructor
- {
- var result:Array = constructorParser.parse(reflection.factory);
- var constructor:Constructor = result[0] as Constructor;
- return constructor;
- }
-
- private function getMetadata(reflection:XML):Array
- {
- return metadataParser.parse(reflection.factory.metadata);
- }
-
- internal function hasTypeCached(type:Class):Boolean
- {
- return cache[type] != null;
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/query/WithMetadata.as b/src/uk/co/ziazoo/fussy/query/WithMetadata.as
deleted file mode 100644
index e60a8d8..0000000
--- a/src/uk/co/ziazoo/fussy/query/WithMetadata.as
+++ /dev/null
@@ -1,21 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
-
- dynamic public class WithMetadata implements IQueryPart
- {
- private var name:String;
-
- public function WithMetadata(name:String)
- {
- this.name = name;
- }
-
- public function filter(data:XMLList):XMLList
- {
- var a:String = data.toString();
- return data.(
- hasOwnProperty("metadata") && metadata.(@name == name).length() > 0
- );
- }
- }
-}
\ No newline at end of file
diff --git a/src/uk/co/ziazoo/fussy/variables/VariableQueryChain.as b/src/uk/co/ziazoo/fussy/variables/VariableQueryChain.as
deleted file mode 100644
index 5a38d5d..0000000
--- a/src/uk/co/ziazoo/fussy/variables/VariableQueryChain.as
+++ /dev/null
@@ -1,20 +0,0 @@
-package uk.co.ziazoo.fussy.variables
-{
- import uk.co.ziazoo.fussy.IReflector;
- import uk.co.ziazoo.fussy.parser.IResultParser;
- import uk.co.ziazoo.fussy.properties.PropertyQueryChain;
-
- public class VariableQueryChain extends PropertyQueryChain
- {
- public function VariableQueryChain(reflector:IReflector,
- parser:IResultParser)
- {
- super(reflector, parser);
- }
-
- override protected function getList(reflection:XML):XMLList
- {
- return reflection.factory.variable;
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/Banana.as b/test/uk/co/ziazoo/fussy/Banana.as
deleted file mode 100644
index d1d3f6d..0000000
--- a/test/uk/co/ziazoo/fussy/Banana.as
+++ /dev/null
@@ -1,9 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- public class Banana
- {
- public function Banana(thing:Wibble, list:Array)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/Bubbles.as b/test/uk/co/ziazoo/fussy/Bubbles.as
deleted file mode 100644
index 3d06830..0000000
--- a/test/uk/co/ziazoo/fussy/Bubbles.as
+++ /dev/null
@@ -1,59 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- [Fussy]
- public class Bubbles
- {
- public var wibble:Wibble;
-
- public var wobble:int;
-
- public var foo:String;
-
- [Fussy]
- public var bar:String;
-
- public function Bubbles(thing:Wibble)
- {
- }
-
- [Inject]
- public function wowowo(a:int, b:String):void
- {
- }
-
- [Inject]
- [Fussy(thing="bacon")]
- public function bebeb():void
- {
- }
-
- public function doIt(a:int = 0):void
- {
-
- }
-
- public function bebeboo(h:Object, r:Object):void
- {
- }
-
- public function get sammy():Array
- {
- return null;
- }
-
- public function get window():Object
- {
- return null;
- }
-
- public function set window(value:Object):void
- {
- }
-
- [Inject]
- public function set thing(value:String):void
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/FussyTest.as b/test/uk/co/ziazoo/fussy/FussyTest.as
deleted file mode 100644
index 4c4aef0..0000000
--- a/test/uk/co/ziazoo/fussy/FussyTest.as
+++ /dev/null
@@ -1,110 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.model.Method;
- import uk.co.ziazoo.fussy.query.IQuery;
-
- public class FussyTest
- {
-
- [Test]
- public function findInjectableMethods():void
- {
- var fussy:Fussy = new Fussy();
- var query:IQuery = fussy.query().findMethods().withMetadata("Inject").withArguments();
-
- var list:Array = query.forType(Bubbles);
-
- Assert.assertEquals(1, list.length);
-
- var method:Method = list[0] as Method;
- Assert.assertEquals(method.name, "wowowo");
- Assert.assertEquals(method.parameters.length, 2);
- }
-
- [Test]
- public function findInjectableProperties():void
- {
- var fussy:Fussy = new Fussy();
- var query:IQuery = fussy.query().findProperties().withMetadata("Inject");
-
- var list:Array = query.forType(Bubbles);
-
- Assert.assertEquals(1, list.length);
- }
-
- [Test]
- public function findInjectableVars():void
- {
- var fussy:Fussy = new Fussy();
- var query:IQuery = fussy.query().findVariables().withMetadata("Inject");
-
- var list:Array = query.forType(Bubbles);
-
- Assert.assertEquals(0, list.length);
- }
-
- [Test]
- public function filterBySignature():void
- {
- var fussy:Fussy = new Fussy();
- var query:IQuery = fussy.query().findMethods().withTypeSignature(int, String);
-
- var list:Array = query.forType(Bubbles);
- Assert.assertEquals(1, list.length);
-
- var method:Method = list[0] as Method;
- Assert.assertEquals(method.name, "wowowo");
- }
-
- [Test]
- public function filterByArgsLength():void
- {
- var fussy:Fussy = new Fussy();
- var query:IQuery = fussy.query().findMethods().withArgsLengthOf(1);
-
- var list:Array = query.forType(Bubbles);
- Assert.assertEquals(1, list.length);
-
- var method:Method = list[0] as Method;
- Assert.assertEquals(method.name, "doIt");
- }
-
- [Test]
- [Ignore]
- public function letsSee():void
- {
- var a:XML = describeType(Thing);
- trace(a);
-
- var ns:Namespace = new Namespace("inject.demo");
- var thing:Thing = new Thing();
- var f:* = ns::thing["doItBacon"];
-
- trace(f);
- }
-
-
- [Test]
- public function issue3Test():void
- {
- var fussy:Fussy = new Fussy();
- var query1:IQuery = fussy.query().findVariables().withMetadata("Fussy");
- var list1:Array = query1.forType(Bubbles);
-
- Assert.assertEquals(list1.length, 1);
- trace("list1.length:", list1.length);
- }
-
- [Test]
- [Ignore]
- public function getTypeDescription():void
- {
- var fussy:Fussy = new Fussy();
- var description:TypeDescription = fussy.query().getTypeQuery().forType(Bubbles);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/ReflectorTest.as b/test/uk/co/ziazoo/fussy/ReflectorTest.as
deleted file mode 100644
index 1f8bbde..0000000
--- a/test/uk/co/ziazoo/fussy/ReflectorTest.as
+++ /dev/null
@@ -1,113 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- import flash.system.Capabilities;
- import flash.utils.getQualifiedClassName;
-
- import org.flexunit.Assert;
-
- public class ReflectorTest
- {
- private var reflector:Reflector;
-
- public function ReflectorTest()
- {
- }
-
- [Before]
- public function setUp():void
- {
- reflector = new Reflector();
- }
-
- [After]
- public function tearDown():void
- {
- reflector = null;
- }
-
- [Test]
- public function doesCache():void
- {
- var desc:XML = reflector.forType(Bubbles);
- Assert.assertNotNull(desc);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- }
-
- [Test]
- public function getCorrectResult():void
- {
- var desc:XML = reflector.forType(Bubbles);
- Assert.assertNotNull(desc);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
-
- Assert.assertEquals(desc, reflector.forType(Bubbles));
- }
-
- [Test]
- public function getForQName():void
- {
- var desc:XML = reflector.forQName(getQualifiedClassName(Bubbles));
- Assert.assertNotNull(desc);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
-
- Assert.assertEquals(desc, reflector.forType(Bubbles));
- }
-
- [Test]
- public function clearAll():void
- {
- reflector.forType(Bubbles);
- reflector.forType(Wibble);
- reflector.forType(Array);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- Assert.assertEquals(true, reflector.hasReflection(Wibble));
- Assert.assertEquals(true, reflector.hasReflection(Array));
-
- reflector.clearAll();
-
- Assert.assertEquals(false, reflector.hasReflection(Bubbles));
- Assert.assertEquals(false, reflector.hasReflection(Wibble));
- Assert.assertEquals(false, reflector.hasReflection(Array));
- }
-
- [Test]
- public function clearSomeByType():void
- {
- reflector.forType(Bubbles);
- reflector.forType(Wibble);
- reflector.forType(Array);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- Assert.assertEquals(true, reflector.hasReflection(Wibble));
- Assert.assertEquals(true, reflector.hasReflection(Array));
-
- reflector.clearForType(Wibble)
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- Assert.assertEquals(false, reflector.hasReflection(Wibble));
- Assert.assertEquals(true, reflector.hasReflection(Array));
- }
-
- [Test]
- public function clearSomeByQName():void
- {
- reflector.forType(Bubbles);
- reflector.forType(Wibble);
- reflector.forType(Array);
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- Assert.assertEquals(true, reflector.hasReflection(Wibble));
- Assert.assertEquals(true, reflector.hasReflection(Array));
-
- reflector.clearForQName(getQualifiedClassName(Wibble));
-
- Assert.assertEquals(true, reflector.hasReflection(Bubbles));
- Assert.assertEquals(false, reflector.hasReflection(Wibble));
- Assert.assertEquals(true, reflector.hasReflection(Array));
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/Thing.as b/test/uk/co/ziazoo/fussy/Thing.as
deleted file mode 100644
index c8fe784..0000000
--- a/test/uk/co/ziazoo/fussy/Thing.as
+++ /dev/null
@@ -1,30 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- use namespace demo;
- use namespace nibble;
-
- public class Thing
- {
- public function Thing()
- {
- }
-
- demo function imInDemoNameSpace():void
- {
-
- }
-
- nibble function doItBacon():void
- {
-
- }
-
- demo function doItBacon():void
- {
-
- }
- }
-}
-
-namespace nibble = "inject.nibble";
-namespace foo = "inject.foo";
diff --git a/test/uk/co/ziazoo/fussy/Wibble.as b/test/uk/co/ziazoo/fussy/Wibble.as
deleted file mode 100644
index 35af876..0000000
--- a/test/uk/co/ziazoo/fussy/Wibble.as
+++ /dev/null
@@ -1,25 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- public class Wibble
- {
- public function Wibble()
- {
- }
-
- [Inject]
- public function doIt():void
- {
-
- }
-
- public function wobble(list:Array):String
- {
- return null;
- }
-
- public function set aaa(value:Object):void
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/accessors/ReadAndWriteTest.as b/test/uk/co/ziazoo/fussy/accessors/ReadAndWriteTest.as
deleted file mode 100644
index 7f1406e..0000000
--- a/test/uk/co/ziazoo/fussy/accessors/ReadAndWriteTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class ReadAndWriteTest
- {
- private var accessors:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- accessors = description.factory.accessor;
- }
-
- [After]
- public function tearDown():void
- {
- accessors = null;
- }
-
- [Test]
- public function all_readable_accessors():void
- {
- var readAndWrite:ReadAndWrite = new ReadAndWrite();
- var result:XMLList = readAndWrite.filter(accessors);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 1);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/accessors/ReadOnlyTest.as b/test/uk/co/ziazoo/fussy/accessors/ReadOnlyTest.as
deleted file mode 100644
index 8ca54e3..0000000
--- a/test/uk/co/ziazoo/fussy/accessors/ReadOnlyTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class ReadOnlyTest
- {
- private var accessors:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- accessors = description.factory.accessor;
- }
-
- [After]
- public function tearDown():void
- {
- accessors = null;
- }
-
- [Test]
- public function all_readable_accessors():void
- {
- var readOnly:ReadOnly = new ReadOnly();
- var result:XMLList = readOnly.filter(accessors);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 1);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/accessors/ReadableTest.as b/test/uk/co/ziazoo/fussy/accessors/ReadableTest.as
deleted file mode 100644
index 7627506..0000000
--- a/test/uk/co/ziazoo/fussy/accessors/ReadableTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class ReadableTest
- {
- private var accessors:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- accessors = description.factory.accessor;
- }
-
- [After]
- public function tearDown():void
- {
- accessors = null;
- }
-
- [Test]
- public function all_readable_accessors():void
- {
- var readable:Readable = new Readable();
- var result:XMLList = readable.filter(accessors);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 2);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/accessors/WritableTest.as b/test/uk/co/ziazoo/fussy/accessors/WritableTest.as
deleted file mode 100644
index ffa2abd..0000000
--- a/test/uk/co/ziazoo/fussy/accessors/WritableTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class WritableTest
- {
- private var accessors:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- accessors = description.factory.accessor;
- }
-
- [After]
- public function tearDown():void
- {
- accessors = null;
- }
-
- [Test]
- public function all_writeable_accessors():void
- {
- var writeable:Writable = new Writable();
- var result:XMLList = writeable.filter(accessors);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 2);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/accessors/WriteOnlyTest.as b/test/uk/co/ziazoo/fussy/accessors/WriteOnlyTest.as
deleted file mode 100644
index 771f67c..0000000
--- a/test/uk/co/ziazoo/fussy/accessors/WriteOnlyTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.accessors
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class WriteOnlyTest
- {
- private var accessors:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- accessors = description.factory.accessor;
- }
-
- [After]
- public function tearDown():void
- {
- accessors = null;
- }
-
- [Test]
- public function all_writeable_accessors():void
- {
- var writeOnly:WriteOnly = new WriteOnly();
- var result:XMLList = writeOnly.filter(accessors);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 1);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/demo.as b/test/uk/co/ziazoo/fussy/demo.as
deleted file mode 100644
index cfba751..0000000
--- a/test/uk/co/ziazoo/fussy/demo.as
+++ /dev/null
@@ -1,4 +0,0 @@
-package uk.co.ziazoo.fussy
-{
- public namespace demo="inject.demo";
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/ArgumentsLengthOfTest.as b/test/uk/co/ziazoo/fussy/methods/ArgumentsLengthOfTest.as
deleted file mode 100644
index aea1506..0000000
--- a/test/uk/co/ziazoo/fussy/methods/ArgumentsLengthOfTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import org.flexunit.Assert;
-
- public class ArgumentsLengthOfTest
- {
- public function ArgumentsLengthOfTest()
- {
- }
-
- [Test]
- public function checkLength():void
- {
- var queryPart:ArgumentsLengthOf = new ArgumentsLengthOf(3);
-
- var methods:XML =
-
-
-
-
-
-
-
-
-
-
- ;
-
- var result:XMLList = queryPart.filter(methods.method);
-
- Assert.assertEquals(1, result.length());
- Assert.assertEquals("demo", result.@name);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/HasTypeSignatureTest.as b/test/uk/co/ziazoo/fussy/methods/HasTypeSignatureTest.as
deleted file mode 100644
index 80b3694..0000000
--- a/test/uk/co/ziazoo/fussy/methods/HasTypeSignatureTest.as
+++ /dev/null
@@ -1,37 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Wibble;
-
- public class HasTypeSignatureTest
- {
- public function HasTypeSignatureTest()
- {
- }
-
- [Test]
- public function checkTypes():void
- {
- var queryPart:HasTypeSignature = new HasTypeSignature([int, String, Wibble]);
-
- var methods:XML =
-
-
-
-
-
-
-
-
-
-
- ;
-
- var result:XMLList = queryPart.filter(methods.method);
-
- Assert.assertEquals(1, result.length());
- Assert.assertEquals("demo", result.@name);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/MethodQueryChainTest.as b/test/uk/co/ziazoo/fussy/methods/MethodQueryChainTest.as
deleted file mode 100644
index ca12515..0000000
--- a/test/uk/co/ziazoo/fussy/methods/MethodQueryChainTest.as
+++ /dev/null
@@ -1,32 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import flash.utils.describeType;
-
- import uk.co.ziazoo.fussy.Bubbles;
- import uk.co.ziazoo.fussy.Reflector;
-
- public class MethodQueryChainTest
- {
- private var methodsList:XMLList;
-
- [Before]
- public function setUp():void
- {
- var tmp:XML = describeType(Bubbles);
- methodsList = tmp.factory.method;
- }
-
- [After]
- public function tearDown():void
- {
- methodsList = null;
- }
-
- [Test]
- public function createNameQuery():void
- {
- var chain:MethodQueryChain = new MethodQueryChain(new Reflector(), null);
- chain.named("wowowo");
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/NoArgsTest.as b/test/uk/co/ziazoo/fussy/methods/NoArgsTest.as
deleted file mode 100644
index 124441b..0000000
--- a/test/uk/co/ziazoo/fussy/methods/NoArgsTest.as
+++ /dev/null
@@ -1,34 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class NoArgsTest
- {
- private var methods:XMLList;
-
- [Before]
- public function setUp():void
- {
- methods = describeType(Bubbles).factory.method;
- }
-
- [After]
- public function tearDown():void
- {
- methods = null;
- }
-
- [Test]
- public function noNeededArgs():void
- {
- var noArgs:NoArgs = new NoArgs();
- var result:XMLList = noArgs.filter(methods);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 1);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/NoCompulsoryArgsTest.as b/test/uk/co/ziazoo/fussy/methods/NoCompulsoryArgsTest.as
deleted file mode 100644
index 9390fc6..0000000
--- a/test/uk/co/ziazoo/fussy/methods/NoCompulsoryArgsTest.as
+++ /dev/null
@@ -1,34 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class NoCompulsoryArgsTest
- {
- private var methods:XMLList;
-
- [Before]
- public function setUp():void
- {
- methods = describeType(Bubbles).factory.method;
- }
-
- [After]
- public function tearDown():void
- {
- methods = null;
- }
-
- [Test]
- public function noNeededArgs():void
- {
- var noArgs:NoCompulsoryArgs = new NoCompulsoryArgs();
- var result:XMLList = noArgs.filter(methods);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 2);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/methods/WithArgumentsTest.as b/test/uk/co/ziazoo/fussy/methods/WithArgumentsTest.as
deleted file mode 100644
index de5c566..0000000
--- a/test/uk/co/ziazoo/fussy/methods/WithArgumentsTest.as
+++ /dev/null
@@ -1,38 +0,0 @@
-package uk.co.ziazoo.fussy.methods
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class WithArgumentsTest
- {
- private var methods:XMLList;
-
- public function WithArgumentsTest()
- {
- }
-
- [Before]
- public function setUp():void
- {
- methods = describeType(Bubbles).factory.method;
- }
-
- [After]
- public function tearDown():void
- {
- methods = null;
- }
-
- [Test]
- public function noNeededArgs():void
- {
- var withArgs:WithArguments = new WithArguments();
- var result:XMLList = withArgs.filter(methods);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 3);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/parser/ConstructorParserTest.as b/test/uk/co/ziazoo/fussy/parser/ConstructorParserTest.as
deleted file mode 100644
index d4d5820..0000000
--- a/test/uk/co/ziazoo/fussy/parser/ConstructorParserTest.as
+++ /dev/null
@@ -1,61 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Banana;
- import uk.co.ziazoo.fussy.Bubbles;
- import uk.co.ziazoo.fussy.Fussy;
- import uk.co.ziazoo.fussy.Reflector;
- import uk.co.ziazoo.fussy.model.Constructor;
- import uk.co.ziazoo.fussy.model.Parameter;
-
- public class ConstructorParserTest
- {
- public function ConstructorParserTest()
- {
- }
-
- [Test]
- public function parseConsructor():void
- {
- var parser:ConstructorParser =
- new ConstructorParser(new ParameterParser());
-
- var reflector:Reflector = new Reflector();
-
- var result:Array = parser.parse(reflector.forType(Banana).factory);
-
- var constructor:Constructor = result[0] as Constructor;
-
- Assert.assertNotNull(constructor);
- Assert.assertEquals(2, constructor.parameters.length);
-
- var param1:Parameter = constructor.parameters[0] as Parameter;
- Assert.assertEquals("uk.co.ziazoo.fussy::Wibble", param1.type);
-
- var param2:Parameter = constructor.parameters[1] as Parameter;
- Assert.assertEquals("Array", param2.type);
- }
-
- [Test]
- public function parseOneParamConsructor():void
- {
- var parser:ConstructorParser =
- new ConstructorParser(new ParameterParser());
-
- var reflector:Reflector = new Reflector();
-
- var result:Array = parser.parse(reflector.forType(Bubbles).factory);
-
- var constructor:Constructor = result[0] as Constructor;
-
- Assert.assertNotNull(constructor);
- Assert.assertEquals(1, constructor.parameters.length);
-
- var param1:Parameter = constructor.parameters[0] as Parameter;
- Assert.assertEquals("uk.co.ziazoo.fussy::Wibble", param1.type);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/parser/MetadataParserTest.as b/test/uk/co/ziazoo/fussy/parser/MetadataParserTest.as
deleted file mode 100644
index be29132..0000000
--- a/test/uk/co/ziazoo/fussy/parser/MetadataParserTest.as
+++ /dev/null
@@ -1,52 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.model.Metadata;
-
- public class MetadataParserTest
- {
- public function MetadataParserTest()
- {
- }
-
- [Test]
- public function parseSomeMetadata():void
- {
- var parser:MetadataParser = new MetadataParser();
- var root:XML =
-
-
-
-
-
- ;
-
- var all:XMLList = root.metadata;
-
- var result:Array = parser.parse(all);
-
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length == 3);
- }
-
- [Test]
- public function parseOne():void
- {
- var parser:MetadataParser = new MetadataParser();
- var root:XML =
-
-
-
- ;
-
- var one:Array = parser.parse(root.metadata);
-
- var metadata:Metadata = one[0] as Metadata;
-
- Assert.assertNotNull(metadata);
- Assert.assertTrue(metadata.name == "Fussy");
- Assert.assertTrue(metadata.properties["thing"] == "bacon");
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/parser/MethodParserTest.as b/test/uk/co/ziazoo/fussy/parser/MethodParserTest.as
deleted file mode 100644
index dabb123..0000000
--- a/test/uk/co/ziazoo/fussy/parser/MethodParserTest.as
+++ /dev/null
@@ -1,73 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.model.Method;
-
- public class MethodParserTest
- {
- public function MethodParserTest()
- {
- }
-
- [Test]
- public function parseSomeMethods():void
- {
- var parser:MethodParser = new MethodParser(
- new ParameterParser(), new MetadataParser());
-
- var root:XML =
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var result:Array = parser.parse(root.method);
-
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length == 4);
- }
-
- [Test]
- public function parseOne():void
- {
- var parser:MethodParser = new MethodParser(
- new ParameterParser(), new MetadataParser());
-
- var root:XML =
-
-
-
-
-
- ;
-
- var result:Array = parser.parse(root.method);
-
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length == 1);
-
- var method:Method;
- method = result[0] as Method;
-
- Assert.assertTrue(method.name == "wowowo");
- Assert.assertTrue(method.parameters.length == 2);
- Assert.assertTrue(method.metadata.length == 1);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/parser/ParameterParserTest.as b/test/uk/co/ziazoo/fussy/parser/ParameterParserTest.as
deleted file mode 100644
index 2047d91..0000000
--- a/test/uk/co/ziazoo/fussy/parser/ParameterParserTest.as
+++ /dev/null
@@ -1,71 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import uk.co.ziazoo.fussy.model.*;
-
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
- import uk.co.ziazoo.fussy.parser.ParameterParser;
-
- public class ParameterParserTest
- {
- private var paramList:XMLList;
-
- public function ParameterParserTest()
- {
- }
-
- [Before]
- public function setUp():void
- {
- paramList = describeType(Bubbles).factory.method.parameter;
- }
-
- [After]
- public function tearDown():void
- {
- paramList = null;
- }
-
-
- [Test]
- public function parseListOfParameters():void
- {
- var parser:ParameterParser = new ParameterParser();
- var parameters:Array = parser.parse(paramList);
-
- Assert.assertNotNull(parameters);
- Assert.assertTrue(parameters.length == 5);
-
- var index:int = parameters.length - 1;
- while (index >= 0)
- {
- var param:Object = parameters[index];
- Assert.assertNotNull(param);
- Assert.assertTrue(param is Parameter);
-
- index --;
- }
- }
-
- [Test]
- public function parseOneParam():void
- {
- var p:XMLList = new XMLList('' +
- '');
-
- var parser:ParameterParser = new ParameterParser();
- var params:Array = parser.parse(p);
-
- Assert.assertTrue(params.length == 1);
-
- var param:Parameter = params[0] as Parameter;
- Assert.assertNotNull(param);
- Assert.assertTrue(param.index == 1);
- Assert.assertTrue(param.optional == true);
- Assert.assertTrue(param.type == "uk.co.ziazoo.fussy::Bubbles");
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/parser/PropertyParserTest.as b/test/uk/co/ziazoo/fussy/parser/PropertyParserTest.as
deleted file mode 100644
index f3502f6..0000000
--- a/test/uk/co/ziazoo/fussy/parser/PropertyParserTest.as
+++ /dev/null
@@ -1,93 +0,0 @@
-package uk.co.ziazoo.fussy.parser
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
- import uk.co.ziazoo.fussy.model.Accessor;
- import uk.co.ziazoo.fussy.model.Metadata;
- import uk.co.ziazoo.fussy.model.Property;
- import uk.co.ziazoo.fussy.model.Variable;
-
- public class PropertyParserTest
- {
- private var parser:PropertyParser;
-
- public function PropertyParserTest()
- {
- }
-
- [Before]
- public function setUp():void
- {
- var metadataParser:MetadataParser = new MetadataParser();
- parser = new PropertyParser(
- new VariableParser(metadataParser),
- new AccessorParser(metadataParser));
- }
-
- [Test]
- public function tearDown():void
- {
- parser = null;
- }
-
-
- [Test]
- public function parseSomeProperties():void
- {
- var description:XML = describeType(Bubbles);
- var p:XMLList = new XMLList();
- p.appendChild(description.factory.variable);
- p.appendChild(description.factory.accessor);
- var props:XMLList = p.*;
-
- var properties:Array = parser.parse(props);
-
- Assert.assertNotNull(properties);
- Assert.assertTrue(properties.length == 7);
- }
-
- [Test]
- public function canParseVariable():void
- {
- var v:XMLList = new XMLList(
-
- );
-
- var properties:Array = parser.parse(v.*);
-
- Assert.assertNotNull(properties);
- Assert.assertTrue(properties.length == 1);
-
- var prop:Variable = properties[0] as Variable;
-
- Assert.assertEquals("wibble", prop.name);
- Assert.assertEquals("uk.co.ziazoo.fussy::Wibble", prop.type);
- }
-
- [Test]
- public function canParseAccessor():void
- {
- var v:XMLList = new XMLList(
-
-
-
- );
-
- var properties:Array = parser.parse(v.*);
-
- Assert.assertNotNull(properties);
- Assert.assertTrue(properties.length == 1);
-
- var prop:Accessor = properties[0] as Accessor;
-
- Assert.assertEquals("thing", prop.name);
- Assert.assertEquals("String", prop.type);
- Assert.assertEquals(1, prop.metadata.length);
- Assert.assertEquals("writeonly", prop.access);
- Assert.assertEquals("uk.co.ziazoo.fussy::Bubbles", prop.declaredBy);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/properties/OfTypeTest.as b/test/uk/co/ziazoo/fussy/properties/OfTypeTest.as
deleted file mode 100644
index 6365416..0000000
--- a/test/uk/co/ziazoo/fussy/properties/OfTypeTest.as
+++ /dev/null
@@ -1,38 +0,0 @@
-package uk.co.ziazoo.fussy.properties
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class OfTypeTest
- {
- private var properties:XMLList;
-
- [Before]
- public function setUp():void
- {
- var description:XML = describeType(Bubbles);
- var p:XMLList = new XMLList();
- p.appendChild(description.factory.variable);
- p.appendChild(description.factory.accessor);
- properties = p.*;
- }
-
- [After]
- public function tearDown():void
- {
- properties = null;
- }
-
- [Test]
- public function all_props_of_string():void
- {
- var ofType:OfType = new OfType(String);
- var result:XMLList = ofType.filter(properties);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 3);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/query/NamedTest.as b/test/uk/co/ziazoo/fussy/query/NamedTest.as
deleted file mode 100644
index 60be5c4..0000000
--- a/test/uk/co/ziazoo/fussy/query/NamedTest.as
+++ /dev/null
@@ -1,35 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class NamedTest
- {
- private var methods:XMLList;
-
- [Before]
- public function setUp():void
- {
- methods = describeType(Bubbles).factory.method;
- }
-
- [After]
- public function tearDown():void
- {
- methods = null;
- }
-
- [Test]
- public function getOne():void
- {
- var named:Named = new Named("wowowo");
- var result:XMLList = named.filter(methods);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 1);
- Assert.assertTrue(String(result.@name) == "wowowo");
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/query/TypeQueryTest.as b/test/uk/co/ziazoo/fussy/query/TypeQueryTest.as
deleted file mode 100644
index 1d618c0..0000000
--- a/test/uk/co/ziazoo/fussy/query/TypeQueryTest.as
+++ /dev/null
@@ -1,52 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
- import uk.co.ziazoo.fussy.Reflector;
- import uk.co.ziazoo.fussy.TypeDescription;
- import uk.co.ziazoo.fussy.parser.ConstructorParser;
- import uk.co.ziazoo.fussy.parser.MetadataParser;
- import uk.co.ziazoo.fussy.parser.ParameterParser;
-
- public class TypeQueryTest
- {
- private var typeQuery:TypeQuery;
-
- public function TypeQueryTest()
- {
- }
-
- [Before]
- public function setUp():void
- {
- typeQuery = new TypeQuery(new Reflector(),
- new ConstructorParser(new ParameterParser()), new MetadataParser());
- }
-
- [After]
- public function tearDown():void
- {
- typeQuery = null;
- }
-
- [Test]
- public function getsTypeDescription():void
- {
- var description:TypeDescription = typeQuery.forType(Bubbles);
-
- Assert.assertEquals("uk.co.ziazoo.fussy::Bubbles", description.qName);
- Assert.assertEquals(true, description.isDynamic);
- Assert.assertEquals(true, description.isFinal);
-
- Assert.assertNotNull(description.constructor);
- Assert.assertNotNull(description.metadata);
-
- Assert.assertEquals(1, description.constructor.parameters.length);
- Assert.assertEquals(1, description.constructor.parameters.length);
- Assert.assertEquals(1, description.metadata.length);
- }
- }
-}
\ No newline at end of file
diff --git a/test/uk/co/ziazoo/fussy/query/WithMetadataTest.as b/test/uk/co/ziazoo/fussy/query/WithMetadataTest.as
deleted file mode 100644
index e76e1e6..0000000
--- a/test/uk/co/ziazoo/fussy/query/WithMetadataTest.as
+++ /dev/null
@@ -1,47 +0,0 @@
-package uk.co.ziazoo.fussy.query
-{
- import flash.utils.describeType;
-
- import org.flexunit.Assert;
-
- import uk.co.ziazoo.fussy.Bubbles;
-
- public class WithMetadataTest
- {
- private var methods:XMLList;
- private var props:XMLList;
-
- [Before]
- public function setUp():void
- {
- methods = describeType(Bubbles).factory.method;
- var p:XMLList = new XMLList();
- p.appendChild(describeType(Bubbles).factory.variable);
- p.appendChild(describeType(Bubbles).factory.accessor);
- props = p.*;
- }
-
- [After]
- public function tearDown():void
- {
- methods = null;
- }
-
- [Test]
- public function filters():void
- {
- var withMetadata:WithMetadata = new WithMetadata("Inject");
- var result:XMLList = withMetadata.filter(methods);
- Assert.assertNotNull(result);
- Assert.assertTrue(result.length() == 2);
- }
-
- [Test]
- public function filterOnProps():void
- {
- var withMetadata:WithMetadata = new WithMetadata("Inject");
- var result:XMLList = withMetadata.filter(props);
- Assert.assertTrue(result.length() == 1);
- }
- }
-}
\ No newline at end of file