Hi Alex, I see you are working on amf.

Not sure if you noticed already or not, but just in case.... I did add
class alias support methods in the reflection package for both targets. I
tested this to work the same for swf and js. (for multiple aliases etc).
registerClassAlias
getAliasByClass
getClassByAlias

see flexUnitTests.reflection.ReflectionTesterTestAlias inside
manualtests/UnitTests




On Wed, Aug 23, 2017 at 3:20 PM, <aha...@apache.org> wrote:

> ClassAliasBead for registering class aliases for AMF
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/4c2b0cfb
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/4c2b0cfb
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/4c2b0cfb
>
> Branch: refs/heads/feature/amf
> Commit: 4c2b0cfb03256391af170324687c9293cc07d13a
> Parents: 909caf1
> Author: Alex Harui <aha...@apache.org>
> Authored: Tue Aug 22 18:09:16 2017 -0700
> Committer: Alex Harui <aha...@apache.org>
> Committed: Tue Aug 22 18:17:09 2017 -0700
>
> ----------------------------------------------------------------------
>  .../flex/org/apache/flex/core/ClassAliasBead.as | 91 ++++++++++++++++++++
>  .../Core/src/main/resources/basic-manifest.xml  |  1 +
>  2 files changed, 92 insertions(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 4c2b0cfb/frameworks/projects/Core/src/main/flex/org/apache/
> flex/core/ClassAliasBead.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ClassAliasBead.as
> b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> core/ClassAliasBead.as
> new file mode 100644
> index 0000000..85ee702
> --- /dev/null
> +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/
> core/ClassAliasBead.as
> @@ -0,0 +1,91 @@
> +///////////////////////////////////////////////////////////
> /////////////////////
> +//
> +//  Licensed to the Apache Software Foundation (ASF) under one or more
> +//  contributor license agreements.  See the NOTICE file distributed with
> +//  this work for additional information regarding copyright ownership.
> +//  The ASF licenses this file to You under the Apache License, Version
> 2.0
> +//  (the "License"); you may not use this file except in compliance with
> +//  the License.  You may obtain a copy of the License at
> +//
> +//      http://www.apache.org/licenses/LICENSE-2.0
> +//
> +//  Unless required by applicable law or agreed to in writing, software
> +//  distributed under the License is distributed on an "AS IS" BASIS,
> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> +//  See the License for the specific language governing permissions and
> +//  limitations under the License.
> +//
> +///////////////////////////////////////////////////////////
> /////////////////////
> +package org.apache.flex.core
> +{
> +    COMPILE::SWF
> +    {
> +        import flash.net.registerClassAlias;
> +        import flash.utils.getDefinitionByName;
> +
> +        import org.apache.flex.events.Event;
> +        import org.apache.flex.events.IEventDispatcher;
> +        import org.apache.flex.events.ValueEvent;
> +    }
> +
> +    /**
> +     *  The ClassAliasBead class is the registers class
> +     *  aliases for serialization/deserialization.
> +     *  Place this bead in the strand of the Application.
> +     *  The compiler leaves information about class aliases
> +     *  on the Application's info object.
> +     *
> +     *  @langversion 3.0
> +     *  @playerversion Flash 10.2
> +     *  @playerversion AIR 2.6
> +     *  @productversion FlexJS 0.0
> +     */
> +       public class ClassAliasBead implements IBead
> +       {
> +        /**
> +         *  Constructor.
> +         *
> +         *  @langversion 3.0
> +         *  @playerversion Flash 10.2
> +         *  @playerversion AIR 2.6
> +         *  @productversion FlexJS 0.0
> +         */
> +               public function ClassAliasBead()
> +               {
> +               }
> +
> +        private var _strand:IStrand;
> +
> +        /**
> +         *  @copy org.apache.flex.core.IBead#strand
> +         *
> +         *  @flexjsignorecoercion org.apache.flex.core.IFlexInfo
> +         *  @flexjsignorecoercion Class
> +         *  @langversion 3.0
> +         *  @playerversion Flash 10.2
> +         *  @playerversion AIR 2.6
> +         *  @productversion FlexJS 0.0
> +         */
> +        public function set strand(value:IStrand):void
> +        {
> +            _strand = value;
> +            COMPILE::SWF
> +            {
> +                var app:IFlexInfo = value as IFlexInfo;
> +                var info:Object = app.info();
> +                var map:Object = info.remoteClassAliases;
> +                if (map)
> +                {
> +                    for (var cn:String in map)
> +                    {
> +                        var alias:String = map[cn];
> +                        var c:Class = getDefinitionByName(cn) as Class;
> +                        registerClassAlias(alias, c);
> +                    }
> +                }
> +            }
> +        }
> +
> +
> +    }
> +}
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 4c2b0cfb/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> index 007c691..ec18097 100644
> --- a/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> +++ b/frameworks/projects/Core/src/main/resources/basic-manifest.xml
> @@ -31,6 +31,7 @@
>      <component id="SimpleStatesImpl" class="org.apache.flex.core.
> SimpleStatesImpl"/>
>      <component id="MXMLDragInitiator" 
> class="org.apache.flex.core.MXMLDragInitiator"
> />
>      <component id="CallLaterBead" class="org.apache.flex.core.CallLaterBead"
> />
> +    <component id="ClassAliasBead" 
> class="org.apache.flex.core.ClassAliasBead"
> />
>
>      <component id="BindableCSSStyles" class="org.apache.flex.core.
> BindableCSSStyles"/>
>      <component id="BindableCSSStylesWithFlex" class="org.apache.flex.core.
> BindableCSSStylesWithFlex"/>
>
>

Reply via email to