Created
February 15, 2011 20:20
-
-
Save trxcllnt/828166 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.errors.IllegalOperationError; | |
import flash.utils.Dictionary; | |
import flash.utils.Proxy; | |
import flash.utils.flash_proxy; | |
use namespace flash_proxy; | |
public dynamic class ImmutableProxy extends Proxy { | |
private const propertyMap:Dictionary = new Dictionary(); | |
override flash_proxy function getProperty(name:*):* { | |
return propertyMap[name]; | |
} | |
override flash_proxy function setProperty(name:*, value:*):void { | |
if (name in propertyMap) { | |
throw new IllegalOperationError("Multiple mutation not supported.") | |
} | |
propertyMap[name] = value; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import flash.utils.flash_proxy; | |
use namespace flash_proxy; | |
class ImmutableVO extends ImmutableProxy { | |
public function get property():* { | |
return flash_proxy::getProperty("property"); | |
} | |
public function set property(value:*):void { | |
flash_proxy::setProperty("property", value); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment