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/a32d34e4 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a32d34e4 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a32d34e4 Branch: refs/heads/feature/amf Commit: a32d34e4491e053eac17da00310397c11182c173 Parents: aea3780 Author: Alex Harui <[email protected]> Authored: Tue Aug 22 18:09:16 2017 -0700 Committer: Carlos Rovira <[email protected]> Committed: Thu Sep 7 00:24:02 2017 +0200 ---------------------------------------------------------------------- .../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/a32d34e4/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/a32d34e4/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"/>
