public sealed override FieldMetadata Read(ObjectContainerBase stream, ClassMetadata
                                                  containingClass, ByteArrayBuffer reader)
        {
            RawFieldSpec spec = ReadSpec(stream, reader);

            return(FromSpec(spec, stream, containingClass));
        }
示例#2
0
		protected override FieldMetadata FromSpec(RawFieldSpec spec, ObjectContainerBase 
			stream, ClassMetadata containingClass)
		{
			FieldMetadata actualField = base.FromSpec(spec, stream, containingClass);
			if (spec == null)
			{
				return null;
			}
			if (spec.IndexID() != 0)
			{
				actualField.InitIndex(stream.SystemTransaction(), spec.IndexID());
			}
			return actualField;
		}
示例#3
0
        protected override FieldMetadata FromSpec(RawFieldSpec spec, ObjectContainerBase
                                                  stream, ClassMetadata containingClass)
        {
            var actualField = base.FromSpec(spec, stream, containingClass);

            if (spec == null)
            {
                return(null);
            }
            if (spec.IndexID() != 0)
            {
                actualField.InitIndex(stream.SystemTransaction(), spec.IndexID());
            }
            return(actualField);
        }
示例#4
0
        protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase
                                                 stream, ByteArrayBuffer reader)
        {
            RawFieldSpec spec = base.ReadSpec(aspectType, stream, reader);

            if (spec == null)
            {
                return(null);
            }
            if (spec.IsVirtual())
            {
                return(spec);
            }
            int indexID = reader.ReadInt();

            spec.IndexID(indexID);
            return(spec);
        }
示例#5
0
		protected virtual FieldMetadata FromSpec(RawFieldSpec spec, ObjectContainerBase stream
			, ClassMetadata containingClass)
		{
			if (spec == null)
			{
				return null;
			}
			string name = spec.Name();
			if (spec.IsVirtualField())
			{
				return stream._handlers.VirtualFieldByName(name);
			}
			if (spec.IsTranslator())
			{
				return new TranslatedAspect(containingClass, name);
			}
			if (spec.IsField())
			{
				return new FieldMetadata(containingClass, name, spec.FieldTypeID(), spec.IsPrimitive
					(), spec.IsArray(), spec.IsNArray());
			}
			return new UnknownTypeHandlerAspect(containingClass, name);
		}
示例#6
0
        protected virtual FieldMetadata FromSpec(RawFieldSpec spec, ObjectContainerBase stream
                                                 , ClassMetadata containingClass)
        {
            if (spec == null)
            {
                return(null);
            }
            var name = spec.Name();

            if (spec.IsVirtualField())
            {
                return(stream._handlers.VirtualFieldByName(name));
            }
            if (spec.IsTranslator())
            {
                return(new TranslatedAspect(containingClass, name));
            }
            if (spec.IsField())
            {
                return(new FieldMetadata(containingClass, name, spec.FieldTypeID(), spec.IsPrimitive
                                             (), spec.IsArray(), spec.IsNArray()));
            }
            return(new UnknownTypeHandlerAspect(containingClass, name));
        }
示例#7
0
		private IReflectClass NormalizeFieldClass(RawFieldSpec fieldInfo, IReflectClass fieldClass
			)
		{
			// TODO: why the following line is necessary?
			IReflectClass theClass = _stream.Reflector().ForName(fieldClass.GetName());
			if (fieldInfo.IsPrimitive())
			{
				theClass = PrimitiveClass(theClass);
			}
			if (fieldInfo.IsArray())
			{
				theClass = ArrayClass(theClass);
			}
			return theClass;
		}
示例#8
0
		private IReflectClass ReflectClassForFieldSpec(RawFieldSpec fieldInfo, IReflector
			 reflector)
		{
			if (fieldInfo.IsVirtualField())
			{
				return VirtualFieldByName(fieldInfo.Name()).ClassReflector(reflector);
			}
			int fieldTypeID = fieldInfo.FieldTypeID();
			switch (fieldTypeID)
			{
				case Handlers4.UntypedId:
				{
					// need to take care of special handlers here
					return ObjectClass();
				}

				case Handlers4.AnyArrayId:
				{
					return ArrayClass(ObjectClass());
				}

				default:
				{
					IReflectClass fieldClass = ForID(fieldTypeID);
					if (null != fieldClass)
					{
						return NormalizeFieldClass(fieldInfo, fieldClass);
					}
					break;
					break;
				}
			}
			return null;
		}