Beispiel #1
0
            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)));
            }
Beispiel #2
0
                public void Apply(object field)
                {
                    if (((IReflectField)field).IsStatic())
                    {
                        return;
                    }
                    if (this._enclosing._enclosing._ignoreTransient && ((IReflectField)field).IsTransient
                            ())
                    {
                        return;
                    }
                    IReflectClass fieldType = ((IReflectField)field).GetFieldType();
                    List4         path      = new List4(parentPath, ((IReflectField)field));

                    Prototypes.IntegerConverter converter = Prototypes.IntegerConverterforClassName(claxx
                                                                                                    .Reflector(), fieldType.GetName());
                    if (converter != null)
                    {
                        int    id = ++this._enclosing.intIdGenerator;
                        object integerRepresentation = converter.FromInteger(id);
                        if (!Prototypes.TrySetField(((IReflectField)field), @object, integerRepresentation
                                                    ))
                        {
                            return;
                        }
                        this._enclosing._fieldsByIntId.Put(id, new Pair(integerRepresentation, path));
                        return;
                    }
                    if (!fieldType.IsPrimitive())
                    {
                        object identityInstance = fieldType.NewInstance();
                        if (identityInstance == null)
                        {
                            return;
                        }
                        if (!Prototypes.TrySetField(((IReflectField)field), @object, identityInstance))
                        {
                            return;
                        }
                        this._enclosing._fieldsByIdentity.Put(identityInstance, path);
                        this._enclosing.Analyze(identityInstance, claxx, depth - 1, path);
                    }
                }
Beispiel #3
0
 private static Prototypes.IntegerConverter IntegerConverterforClassName(IReflector
                                                                         reflector, string className)
 {
     if (_integerConverters == null)
     {
         _integerConverters = new Hashtable4();
         Prototypes.IntegerConverter[] converters = new Prototypes.IntegerConverter[] { new
                                                                                        _IntegerConverter_211(), new _IntegerConverter_215(), new _IntegerConverter_219(
                                                                                            ), new _IntegerConverter_223(), new _IntegerConverter_227(), new _IntegerConverter_231
                                                                                            (), new _IntegerConverter_235(), new _IntegerConverter_239() };
         for (int converterIndex = 0; converterIndex < converters.Length; ++converterIndex)
         {
             Prototypes.IntegerConverter converter = converters[converterIndex];
             _integerConverters.Put(converter.PrimitiveName(), converter);
             if (!converter.PrimitiveName().Equals(converter.WrapperName(reflector)))
             {
                 _integerConverters.Put(converter.WrapperName(reflector), converter);
             }
         }
     }
     return((Prototypes.IntegerConverter)_integerConverters.Get(className));
 }
Beispiel #4
0
		private static Prototypes.IntegerConverter IntegerConverterforClassName(IReflector
			 reflector, string className)
		{
			if (_integerConverters == null)
			{
				_integerConverters = new Hashtable4();
				Prototypes.IntegerConverter[] converters = new Prototypes.IntegerConverter[] { new 
					_IntegerConverter_211(), new _IntegerConverter_215(), new _IntegerConverter_219(
					), new _IntegerConverter_223(), new _IntegerConverter_227(), new _IntegerConverter_231
					(), new _IntegerConverter_235(), new _IntegerConverter_239() };
				for (int converterIndex = 0; converterIndex < converters.Length; ++converterIndex)
				{
					Prototypes.IntegerConverter converter = converters[converterIndex];
					_integerConverters.Put(converter.PrimitiveName(), converter);
					if (!converter.PrimitiveName().Equals(converter.WrapperName(reflector)))
					{
						_integerConverters.Put(converter.WrapperName(reflector), converter);
					}
				}
			}
			return (Prototypes.IntegerConverter)_integerConverters.Get(className);
		}