예제 #1
0
        public virtual object DeepClone(object context)
        {
            TypeHandlerCloneContext typeHandlerCloneContext = (TypeHandlerCloneContext)context;

            Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler original = (Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler
                                                                             )typeHandlerCloneContext.original;
            Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler cloned = (Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler
                                                                           )Reflection4.NewInstance(this);
            cloned._usePrimitiveClassReflector = original._usePrimitiveClassReflector;
            cloned._handler = typeHandlerCloneContext.CorrectHandlerVersion(original.DelegateTypeHandler
                                                                                ());
            return(cloned);
        }
        public virtual object DeepClone(object context)
        {
            TypeHandlerCloneContext      typeHandlerCloneContext = (TypeHandlerCloneContext)context;
            StandardReferenceTypeHandler cloned = (StandardReferenceTypeHandler)Reflection4.NewInstance
                                                      (this);

            if (typeHandlerCloneContext.original is StandardReferenceTypeHandler)
            {
                StandardReferenceTypeHandler original = (StandardReferenceTypeHandler)typeHandlerCloneContext
                                                        .original;
                cloned.ClassMetadata(original.ClassMetadata());
            }
            else
            {
                // New logic: ClassMetadata takes the responsibility in
                //           #correctHandlerVersion() to set the
                //           ClassMetadata directly on cloned handler.
                //            if(_classMetadata == null){
                //                throw new IllegalStateException();
                //            }
                cloned.ClassMetadata(_classMetadata);
            }
            return(cloned);
        }