This days I tried to subclass the TextInput component and seems like the
compiler does not
know anything about the metadata in the superclass...I didnp't have time to
do some test outside
my project but this is a real problem if you try to extends other components
with a myriad of
metadata tags in it.

Could someone at adobe elaborate a bit in the compiler behaviour related to
metadata when subclass
a component?

Thanks!




On 1/28/07, Bjorn Schultheiss <[EMAIL PROTECTED]> wrote:

  Over here we went for subclassing Array to create a typed array class.

There's some examples of a typed array class in the documentation.


--- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, "gtuhl"
<[EMAIL PROTECTED]> wrote:
>
> I'll try to keep this brief and clear, bear with me and please request
> additional information if it would help. We came across a situation
> in a very large Flex2 application where we wanted to know the types of
> items inside of collections at runtime. I can provide more details if
> desired, but in short we are doing a lot of automatic detection of
> object and property types to make a "running locally on xml" version
> of the product work with very little pain and very little extra
> configuration.
>
> In Java 1.5, you can specify these types like this:
>
> List<ContactVO> foo;
>
> In Flex2, if you have something like this:
>
> var foo : ArrayCollection;
>
> There is obviously no way of discovering at runtime, by reading the
> class definition, what types of objects are meant to be in that
> ArrayCollection.
>
> So we took advantage of the metadata construct in Flex2 to create a
> sort of annotation, which would make the Flex2 example look like this:
>
> [Collection(type="ContactVO")]
> var foo : ArrayCollection;
>
> Now by reading the metadata of the property foo, we are able to
> determine at runtime both that foo is an ArrayCollection, and that it
> is meant to contain ContactVO object instances. This doesn't have the
> Java benefit of actually enforcing the fact that only ContactVOs are
> in the collection, but it at least allows us to make very useful
> convention-based assumptions.
>
> This is a pretty powerful option in my opinion, unfortunately Flex2
> blindly throws out all metadata it doesn't understand. Through some
> google code searching, we were able to discover an obscure compiler
> option that looks like this:
>
> -keep-as3-metadata+=Collection
>
> This option would then make it such that Flex does not throw out
> [Collection] metadata.
>
> The problem is, this compiler option only works in DEBUG mode. In
> debug mode all of our code affected by this works beautifully and
> without fault (and would probably be a very useful tool to provide to
> the community). In RUN mode, it fails miserably. In short, Flex2 is
> ignoring these extra compiler options when not in DEBUG mode. We are
> no longer able to see the [Collection] metadata.
>
> Does anyone have any idea for working around this? We are using ANT
> for our builds, and I can guarantee that the -keep-as3-metadata
> compiler option is being used identically in all cases. It simply
> gets ignored in RUN mode, and Flex2 goes back to throwing out all
> metadata it doesn't understand.
>




--
::| Carlos Rovira
::| http://www.carlosrovira.com
::| http://www.madeinflex.com

Reply via email to