Hi,

I'm trying to do some Reflection work and finding some unexpected results.
Given this example class:

package controllers
{
import interfaces.IController;

import models.User;

import services.UserService;

public class UserController implements IController
{
public static const USER_CONTROLLER_EVENT:String = "userControllerEvent";

/**
         * Constructor
         */
public function UserController()
{
trace("UserController constructor");
}

private var _userService:UserService;

[Inject]
public function get userService():UserService
{
    return _userService;
}
public function set userService(value:UserService):void
{
trace("setting userService: ", value);
    _userService = value;
}
[Bindable]
public var currentUser:User;
}
}

I want to retrieve, super class, interface, metadata, const and vars and
methods, so I think I should use this:

var typeDefinition:TypeDefinition = describeType(target);

To see what this retrieves for this email the toString method is great:

typeDefinition.toString(true);

RESULT:

*typeDefinition.toString  Typedefinition: controllers.UserController,
kind:class*
*constructor :*
* method: 'UserController', returnType:''
declaredBy:controllers.UserController*
* {No parameters}*
*interfaces :*
* Typedefinition: interfaces.IController, kind:interface*
* Typedefinition: org.apache.royale.events.IEventDispatcher,
kind:interface. <---- this is unexpected*
*baseClasses :*
* Typedefinition: org.apache.royale.events.EventDispatcher, kind:class. **<----
this is unexpected*
*variables :*
* {none}*
*accessors :*
* accessor: 'currentUser' access:readwrite, type:models.User,
declaredBy:controllers.UserController*
* accessor: 'userService' access:readwrite, type:services.UserService,
declaredBy:controllers.UserController*
*methods :*
* method: 'hasEventListener', returnType:Boolean
declaredBy:org.apache.royale.events.EventDispatcher.  **<---- this is
unexpected (but normal due to EventDispatcher listed as base class*
* parameter 1, optional:false, type:String*
* method: 'dispatchEvent', returnType:Boolean
declaredBy:org.apache.royale.events.EventDispatcher.  * *<---- this is
unexpected (but normal due to EventDispatcher listed as base class*
* parameter 1, optional:false, type:Object*
* method: 'toString', returnType:String
declaredBy:org.apache.royale.events.EventDispatcher * *<---- this is
unexpected (but normal due to EventDispatcher listed as base class*
* {No parameters}*
*static variables :*
* {none} *  *<---- this is unexpected where is *USER_CONTROLLER_EVENT*?*
*static accessors :*
* {none}*
*static methods :*
* {none}*

As I stated in other email, the most annoying thing is the *EventDispatcher*
and *methods* listed as super class of this class...
the other is no *static var* listed

One thing I need most is to retrieve new *Metadata* I want to insert, I'm
taking about the [Inject] metadata, I put [Bindable] as well since is
already used, but I don't see any signals of any one of them

I must say that I have in config/compile-swf-config.xml this code:

<keep-as3-metadata>
<name>Bindable</name>
...
...
<name>Inject</name>
</keep-as3-metadata>

and building with maven

Is this a bug, or maybe this API is unfinished ? or maybe I'm missing
something ?

Thanks


-- 
Carlos Rovira
http://about.me/carlosrovira

Reply via email to