/*
 Copyright (c) 2006 Eric J. Feminella <eric@ericfeminella.com>
 All rights reserved.

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is furnished
 to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 @internal
 */

package com.ericfeminella.net
{
    /**
     * 
     * Defines the contract for serializing / deserializing AMF 
     * encoded classes in order to preserve and retain type
     * 
     */
    public interface IAMFSerializable
    {
        /**
         * 
         * Sets the value of a specified persisted property and 
         * encodes the properties Alias to preserve type. Use this 
         * method if you will need to preserve type information of 
         * a persisted object.
         *
         * <p>
         * Preserves the class (type) information of an object when 
         * the object is encoded in Action Message Format (AMF). When 
         * you persist a property in a shared object the properties 
         * are encoded into AMF. When reading any properties encoded 
         * in AMF, the type information is lost and the property is 
         * returned as an anonymous object. Use this, method so that 
         * you can recover the class when decoding the object.
         * </p>
         *
         * <p>
         * Classes that implement IAMFSerializable use the property 
         * name as the alias for the encoded class. You can then use 
         * the property name to retrieve the class of an encoded property
         * </p>
         *
         * @param the name of the persisted property, this will also be 
         *        used as the alias
         * @param the vlaue of the persisted property
         * @param the class (type) of the property to be persisted
         * 
         */
        function setEncodedPersistedProperty(propertyName:String, value:*, classReference:Class) : void

        /**
         * 
         * Decodes a previously encoded ActionScript class
         *
         * @param the alias used to retieve the class type
         * @return the class encoded via IAMFAliasSerialization.encode();
         * 
         */
        function getDecodedPersistedPropertyClass(propertyName:String) : Class
    }
}