 import dolly.core.dolly_internal;
 import dolly.core.errors.CloningError;
 import dolly.core.metadata.MetadataName;
+import dolly.utils.ClassUtil;
 import dolly.utils.PropertyUtil;
+
+import flash.utils.ByteArray;
 
 import flash.utils.Dictionary;
 


public class Cloner {

	private static function isTypeCloneable(type:Type):Boolean {
		return type.hasMetadata(MetadataName.CLONEABLE);
	}

	private static function failIfTypeIsNotCloneable(type:Type):void {

		}
	}

	private static function prepareTypeForCloning(type:Type):void {
		ClassUtil.registerAliasFor(type.clazz);

		_isClassPreparedForCloningMap[type.clazz] = true;
	}

	dolly_internal static function findAllWritableFieldsForType(type:Type):Vector.<Field> {
		failIfTypeIsNotCloneable(type);

		if (!isTypePreparedForCloning(type)) {
			prepareTypeForCloning(type);
		}

		const result:Vector.<Field> = new Vector.<Field>();

