Esempio n. 1
0
 public virtual IReflector Reflector()
 {
     if (_delegate != null)
     {
         return(_delegate.Reflector());
     }
     return(_reflector);
 }
Esempio n. 2
0
        private IReflectClass PrimitiveClass(IReflectClass baseClass)
        {
            Type primitive = (Type)Primitives.Get(baseClass.GetName());

            if (primitive != null)
            {
                return(baseClass.Reflector().ForClass(primitive));
            }
            return(baseClass);
        }
Esempio n. 3
0
		public HierarchyAnalyzer(ClassMetadata storedClass, IReflectClass runtimeClass)
		{
			if (storedClass == null || runtimeClass == null)
			{
				throw new ArgumentNullException();
			}
			_storedClass = storedClass;
			_runtimeClass = runtimeClass;
			_objectClass = runtimeClass.Reflector().ForClass(typeof(object));
		}
 public HierarchyAnalyzer(ClassMetadata storedClass, IReflectClass runtimeClass)
 {
     if (storedClass == null || runtimeClass == null)
     {
         throw new ArgumentNullException();
     }
     _storedClass  = storedClass;
     _runtimeClass = runtimeClass;
     _objectClass  = runtimeClass.Reflector().ForClass(typeof(object));
 }
Esempio n. 5
0
 private static bool IsObjectClass(IReflectClass claxx)
 {
     // TODO: We should send the whole class meta if we'd like to support
     // java and .net communication (We have this request in our user forum
     // http://developer.db4o.com/forums/thread/31504.aspx). If we only want
     // to support java & .net platform separately, then this method should
     // be moved to Platform4.
     //return className.startsWith("java.lang.Object") || className.startsWith("System.Object");
     return(claxx.Reflector().ForClass(Const4.ClassObject) == claxx);
 }
Esempio n. 6
0
        public static IEnumerator Iterator(IReflectClass claxx, object obj)
        {
            IReflectArray reflectArray = claxx.Reflector().Array();

            if (reflectArray.IsNDimensional(claxx))
            {
                return(MultidimensionalArrayHandler.AllElementsMultidimensional(reflectArray, obj
                                                                                ));
            }
            return(Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler.AllElements(reflectArray
                                                                                    , obj));
        }
Esempio n. 7
0
                public void Apply(object field)
                {
                    if (((IReflectField)field).IsStatic())
                    {
                        return;
                    }
                    if (_enclosing._enclosing._ignoreTransient && ((IReflectField)field).IsTransient
                            ())
                    {
                        return;
                    }
                    var fieldType = ((IReflectField)field).GetFieldType();
                    var path      = new List4(parentPath, ((IReflectField)field));
                    var converter = IntegerConverterforClassName(claxx
                                                                 .Reflector(), fieldType.GetName());

                    if (converter != null)
                    {
                        var id = ++_enclosing.intIdGenerator;
                        var integerRepresentation = converter.FromInteger(id);
                        if (!TrySetField(((IReflectField)field), @object, integerRepresentation
                                         ))
                        {
                            return;
                        }
                        _enclosing._fieldsByIntId.Put(id, new Pair(integerRepresentation, path));
                        return;
                    }
                    if (!fieldType.IsPrimitive())
                    {
                        var identityInstance = fieldType.NewInstance();
                        if (identityInstance == null)
                        {
                            return;
                        }
                        if (!TrySetField(((IReflectField)field), @object, identityInstance))
                        {
                            return;
                        }
                        _enclosing._fieldsByIdentity.Put(identityInstance, path);
                        _enclosing.Analyze(identityInstance, claxx, depth - 1, path);
                    }
                }
 public int CompareTo(object obj)
 {
     if (obj is TransactionContext)
     {
         obj = ((TransactionContext)obj)._object;
     }
     if (obj == null)
     {
         return(_id == 0 ? 0 : 1);
     }
     if (obj is int)
     {
         int targetInt = ((int)obj);
         return(_id == targetInt ? 0 : (_id < targetInt ? -1 : 1));
     }
     if (_claxx != null)
     {
         if (_claxx.IsAssignableFrom(_claxx.Reflector().ForObject(obj)))
         {
             return(0);
         }
     }
     throw new IllegalComparisonException();
 }
Esempio n. 9
0
 public static bool AreEqual(Type expected, IReflectClass actual)
 {
     return(actual.Reflector().ForClass(expected) == actual);
 }
Esempio n. 10
0
        private IReflectClass ArrayClass(IReflectClass clazz)
        {
            object proto = clazz.Reflector().Array().NewInstance(clazz, 0);

            return(clazz.Reflector().ForObject(proto));
        }
		private static bool IsObjectClass(IReflectClass claxx)
		{
			// TODO: We should send the whole class meta if we'd like to support
			// java and .net communication (We have this request in our user forum
			// http://developer.db4o.com/forums/thread/31504.aspx). If we only want
			// to support java & .net platform separately, then this method should
			// be moved to Platform4.
			//return className.startsWith("java.lang.Object") || className.startsWith("System.Object");
			return claxx.Reflector().ForClass(Const4.ClassObject) == claxx;
		}
        /// <summary>
        /// return true if a TypeHandler is to be used for a specific
        /// Type
        /// </summary>
        /// <param name="classReflector">
        /// the Type passed by db4o that is to
        /// be tested by this predicate.
        /// </param>
        /// <returns>
        /// true if the TypeHandler is to be used for a specific
        /// Type.
        /// </returns>
        public bool Match(IReflectClass classReflector)
        {
            var claxx = classReflector.Reflector().ForClass(typeof(CustomFieldInfo));

            return(claxx.Equals(classReflector));
        }
Esempio n. 13
0
		private IReflectClass ArrayClass(IReflectClass clazz)
		{
			object proto = clazz.Reflector().Array().NewInstance(clazz, 0);
			return clazz.Reflector().ForObject(proto);
		}
        public bool Match(IReflectClass candidate)
        {
            IReflectClass reflectClass = candidate.Reflector().ForClass(_class);

            return(candidate == reflectClass);
        }
Esempio n. 15
0
		public static bool AreEqual(Type expected, IReflectClass actual)
		{
			return actual.Reflector().ForClass(expected) == actual;
		}
        /// <summary>
        /// return true if a TypeHandler is to be used for a specific
        /// Type
        /// </summary>
        /// <param name="classReflector">
        /// the Type passed by db4o that is to
        /// be tested by this predicate.
        /// </param>
        /// <returns>
        /// true if the TypeHandler is to be used for a specific
        /// Type.
        /// </returns>
        public bool Match(IReflectClass classReflector)
        {
            var claxx = classReflector.Reflector().ForClass(typeof(ModelVersionNumber));

            return(claxx.Equals(classReflector));
        }
Esempio n. 17
0
		public static IEnumerator Iterator(IReflectClass claxx, object obj)
		{
			IReflectArray reflectArray = claxx.Reflector().Array();
			if (reflectArray.IsNDimensional(claxx))
			{
				return MultidimensionalArrayHandler.AllElementsMultidimensional(reflectArray, obj
					);
			}
			return Db4objects.Db4o.Internal.Handlers.Array.ArrayHandler.AllElements(reflectArray
				, obj);
		}
		public bool Match(IReflectClass candidate)
		{
			IReflectClass reflectClass = candidate.Reflector().ForClass(_class);
			return candidate == reflectClass;
		}
Esempio n. 19
0
		private IReflectClass PrimitiveClass(IReflectClass baseClass)
		{
			Type primitive = (Type)Primitives.Get(baseClass.GetName());
			if (primitive != null)
			{
				return baseClass.Reflector().ForClass(primitive);
			}
			return baseClass;
		}
        /// <summary>
        /// return true if a TypeHandler is to be used for a specific
        /// Type
        /// </summary>
        /// <param name="classReflector">
        /// the Type passed by db4o that is to
        /// be tested by this predicate.
        /// </param>
        /// <returns>
        /// true if the TypeHandler is to be used for a specific
        /// Type.
        /// </returns>
        public bool Match(IReflectClass classReflector)
        {
            var claxx = classReflector.Reflector().ForClass(typeof(CmObjectSurrogate));

            return(claxx.Equals(classReflector));
        }