public virtual IEnumerator BackingFieldPath(IReflector reflector, object expression ) { if (expression == null) { return(null); } IReflectClass claxx = reflector.ForObject(expression); if (claxx == null) { return(null); } Prototypes.IntegerConverter converter = Prototypes.IntegerConverterforClassName(reflector , claxx.GetName()); if (converter != null) { Pair entry = (Pair)this._fieldsByIntId.Get(converter.ToInteger(expression)); if (entry == null) { return(null); } if (entry.first.Equals(expression)) { return(this.AsIterator((List4)entry.second)); } return(null); } if (claxx.IsPrimitive()) { return(null); } return(this.AsIterator((List4)this._fieldsByIdentity.Get(expression))); }
public virtual int[] Dimensions(object arr) { int count = 0; IReflectClass claxx = _reflector.ForObject(arr); while (claxx.IsArray()) { count++; claxx = claxx.GetComponentType(); } int[] dim = new int[count]; for (int i = 0; i < count; i++) { try { dim[i] = GetLength(arr); arr = Get(arr, 0); } catch (Exception) { return(dim); } } return(dim); }
internal virtual IPreparedComparison PrepareComparison(ObjectContainerBase container , object constraint) { IContext context = container.Transaction.Context(); if (_fieldMetadata != null) { return(_fieldMetadata.PrepareComparison(context, constraint)); } if (_classMetadata != null) { return(_classMetadata.PrepareComparison(context, constraint)); } IReflector reflector = container.Reflector(); Db4objects.Db4o.Internal.ClassMetadata classMetadata = null; if (_bytes != null) { classMetadata = container.ProduceClassMetadata(reflector.ForObject(constraint)); } else { if (_member != null) { classMetadata = container.ClassMetadataForReflectClass(reflector.ForObject(_member )); } } if (classMetadata != null) { if (_member != null && _member.GetType().IsArray) { ITypeHandler4 arrayElementTypehandler = classMetadata.TypeHandler(); if (reflector.Array().IsNDimensional(MemberClass())) { MultidimensionalArrayHandler mah = new MultidimensionalArrayHandler(arrayElementTypehandler , false); return(mah.PrepareComparison(context, _member)); } ArrayHandler ya = new ArrayHandler(arrayElementTypehandler, false); return(ya.PrepareComparison(context, _member)); } return(classMetadata.PrepareComparison(context, constraint)); } return(null); }
public virtual IReflectClass ForObject(object obj) { LogMethodCall("forObject", obj); IReflectClass klass = RepositoryForObject(obj); if (null != klass) { return(klass); } return(_delegate.ForObject(obj)); }
/// <summary>Returns a ReflectClass instance for the specified class object</summary> /// <param name="obj">class object</param> /// <returns>a ReflectClass instance for the specified class object</returns> /// <seealso cref="Db4objects.Db4o.Reflect.IReflectClass">Db4objects.Db4o.Reflect.IReflectClass /// </seealso> public virtual IReflectClass ForObject(object obj) { if (obj is GenericObject) { return(ForGenericObject((GenericObject)obj)); } if (obj is GenericArray) { return(((GenericArray)obj)._clazz); } return(_delegate.ForObject(obj)); }
public static IReflectClass ReflectClassFor(IReflector reflector, object clazz) { if (clazz is IReflectClass) { return((IReflectClass)clazz); } if (clazz is Type) { return(reflector.ForClass((Type)clazz)); } if (clazz is string) { return(reflector.ForName((string)clazz)); } return(reflector.ForObject(clazz)); }
public static IReflectClass ReflectClassFor(IReflector reflector, object clazz) { if (clazz is IReflectClass) { return (IReflectClass)clazz; } if (clazz is Type) { return reflector.ForClass((Type)clazz); } if (clazz is string) { return reflector.ForName((string)clazz); } return reflector.ForObject(clazz); }
public virtual string WrapperName(IReflector reflector) { return(reflector.ForObject(FromInteger(1)).GetName()); }
public virtual string WrapperName(IReflector reflector) { return reflector.ForObject(FromInteger(1)).GetName(); }
public virtual IEnumerator BackingFieldPath(IReflector reflector, object expression ) { if (expression == null) { return null; } IReflectClass claxx = reflector.ForObject(expression); if (claxx == null) { return null; } Prototypes.IntegerConverter converter = Prototypes.IntegerConverterforClassName(reflector , claxx.GetName()); if (converter != null) { Pair entry = (Pair)this._fieldsByIntId.Get(converter.ToInteger(expression)); if (entry == null) { return null; } if (entry.first.Equals(expression)) { return this.AsIterator((List4)entry.second); } return null; } if (claxx.IsPrimitive()) { return null; } return this.AsIterator((List4)this._fieldsByIdentity.Get(expression)); }
public IReflectClass ForObject(object o) { Console.WriteLine("Reflector.forObject(" + o + ")"); return(readReflector.ForObject(o)); }