Return to Snippet

Revision: 21757
at December 20, 2009 02:40 by alejandromb


Initial Code
package kc.core {
	
	public class KCClassFactory extends Object implements IPurger {
		
		// @protected
		
		protected var _value:Class;
		protected var _properties:Object;
		
		// @constructor

		public function KCClassFactory( value:Class ) {
			super();
			_value = value;
		}
		
		// @getters
		
		public function get properties():Object {
			return this._properties;
		}

		// @methods
		
		public function newInstance( properties:Object = null ):Class {
			var instance:Class = new _value();
			if( properties != null ){
				_properties = properties;
				for( var key:String in _properties ){
					instance[key] = _properties[key];
				}
			} return instance;
		}
		
		// @purge
		
		public function purge(...rest):void {
			_properties = null;
			_value = null;
		}
		
	}
	
}

Initial URL
http://www.kirikacode.com

Initial Description

                                

Initial Title
AS3 | KCClassFactory

Initial Tags
class

Initial Language
ActionScript 3