-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As3Vanilla - added caching and Enum support #8
base: master
Are you sure you want to change the base?
Changes from 15 commits
e84fdce
b154139
a1613f4
4b3879a
ea071fd
64179d7
39970b1
7b8dc8a
fc10e24
9a4e514
358164a
d2e753e
f4d5e9f
1dda44b
daf332e
0de8458
3e4c3b9
833430c
8967520
6d91bd2
a781666
d79676c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ bin | |
dist | ||
|
||
# IDE crud. | ||
.iml | ||
.project | ||
.idea | ||
.DS_Store | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.osflash.vanilla | ||
{ | ||
|
||
public interface IEnum | ||
{ | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,56 @@ | ||
package org.osflash.vanilla | ||
{ | ||
internal class InjectionDetail | ||
|
||
public class InjectionDetail | ||
{ | ||
private var _fieldName : String; | ||
private var _type : Class; | ||
private var _required : Boolean; | ||
private var _arrayTypeHint : Class; | ||
|
||
public function InjectionDetail(fieldName : String, type : Class, required : Boolean, arrayTypeHint : Class) { | ||
public function InjectionDetail(fieldName : String, type : Class, required : Boolean, arrayTypeHint : Class) | ||
{ | ||
_fieldName = fieldName; | ||
_type = type; | ||
_required = required; | ||
_arrayTypeHint = arrayTypeHint; | ||
} | ||
|
||
public function get name() : String { | ||
return _fieldName; | ||
} | ||
|
||
|
||
private var _fieldName : String; | ||
private var _required : Boolean; | ||
|
||
private var _type : Class; | ||
|
||
public function get type() : Class | ||
{ | ||
return _type; | ||
} | ||
|
||
|
||
|
||
private var _arrayTypeHint : Class; | ||
|
||
public function get arrayTypeHint() : Class | ||
{ | ||
return _arrayTypeHint; | ||
} | ||
|
||
|
||
public function get name() : String | ||
{ | ||
return _fieldName; | ||
} | ||
|
||
|
||
public function get isRequired() : Boolean | ||
{ | ||
return _required; | ||
} | ||
|
||
|
||
public function toString() : String | ||
{ | ||
var result : String = _fieldName + "<" + type + ">"; | ||
if (arrayTypeHint) { | ||
if (arrayTypeHint) | ||
{ | ||
result += "->" + arrayTypeHint; | ||
} | ||
return result; | ||
} | ||
|
||
public function get arrayTypeHint() : Class | ||
{ | ||
return _arrayTypeHint; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,87 @@ | ||
package org.osflash.vanilla | ||
{ | ||
internal class InjectionMap | ||
|
||
public class InjectionMap | ||
{ | ||
private static function getNames(object : Object) : Array | ||
{ | ||
const result : Array = []; | ||
for (var name : String in object) | ||
{ | ||
result.push(name); | ||
} | ||
return result; | ||
} | ||
|
||
|
||
private var _constructorFields : Array = []; | ||
private var _fields : Object = {}; | ||
private var _methods : Object = {}; | ||
|
||
|
||
public function addConstructorField(injectionDetails : InjectionDetail) : void | ||
{ | ||
_constructorFields.push(injectionDetails); | ||
} | ||
|
||
|
||
public function getConstructorFields() : Array | ||
{ | ||
return _constructorFields; | ||
} | ||
|
||
|
||
public function addField(fieldName : String, injectionDetails : InjectionDetail) : void | ||
{ | ||
_fields[fieldName] = injectionDetails; | ||
} | ||
|
||
|
||
|
||
public function getFieldNames() : Array | ||
{ | ||
const result : Array = []; | ||
for (var fieldName : String in _fields) { | ||
result.push(fieldName); | ||
} | ||
return result; | ||
return getNames(_fields); | ||
} | ||
|
||
public function getField(fieldName : String) : InjectionDetail { | ||
|
||
|
||
public function getField(fieldName : String) : InjectionDetail | ||
{ | ||
return _fields[fieldName]; | ||
} | ||
|
||
|
||
public function addMethod(methodName : String, injectionDetails : InjectionDetail) : void | ||
{ | ||
_methods[methodName] ||= []; | ||
(_methods[methodName] as Array).push(injectionDetails); | ||
} | ||
|
||
} | ||
|
||
|
||
public function getMethodsNames() : Array | ||
{ | ||
const result : Array = []; | ||
for (var methodName : String in _methods) { | ||
result.push(methodName); | ||
} | ||
return result; | ||
return getNames(_methods); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey John, as a maintainer of public repo, you can get a free copy of the Matej Šimunić On 6 July 2014 23:27, John Reeves [email protected] wrote:
|
||
} | ||
|
||
|
||
|
||
public function getMethod(methodName : String) : Array | ||
{ | ||
return _methods[methodName]; | ||
} | ||
|
||
|
||
|
||
public function toString() : String | ||
{ | ||
var result : String = "[FieldMap "; | ||
result += "ctor:{" + _constructorFields +"}, "; | ||
|
||
result += "ctor:{" + _constructorFields + "}, "; | ||
result += "fields:{" + _fields + "}, "; | ||
|
||
result += "methods:{"; | ||
for (var methodName : String in _methods) { | ||
for (var methodName : String in _methods) | ||
{ | ||
result += methodName + "(" + getMethod(methodName) + "),"; | ||
} | ||
result += "}"; | ||
|
||
result += "]"; | ||
return result; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package org.osflash.vanilla | ||
{ | ||
|
||
/** | ||
* Global, singleton instance used by the extract() convenience method. | ||
* Global, singleton instance used by the extract() convenience method. | ||
*/ | ||
internal var VANILLA_INSTANCE : Vanilla = new Vanilla(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix tabbing here (2 tabs, not 1).