Ejemplo n.º 1
0
        public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
                                   , ByteArrayBuffer writer)
        {
            writer.WriteShortString(trans, aspect.GetName());
            if (!(aspect is FieldMetadata))
            {
                return;
            }
            FieldMetadata field = (FieldMetadata)aspect;

            field.Alive();
            if (field.IsVirtual())
            {
                return;
            }
            ITypeHandler4 handler = field.GetHandler();

            if (handler is StandardReferenceTypeHandler)
            {
                // TODO: ensure there is a test case, to make this happen
                if (((StandardReferenceTypeHandler)handler).ClassMetadata().GetID() == 0)
                {
                    trans.Container().NeedsUpdate(clazz);
                }
            }
            writer.WriteInt(field.FieldTypeID());
            BitMap4 bitmap = new BitMap4(3);

            bitmap.Set(0, field.IsPrimitive());
            bitmap.Set(1, Handlers4.HandlesArray(handler));
            bitmap.Set(2, Handlers4.HandlesMultidimensionalArray(handler));
            // keep the order
            writer.WriteByte(bitmap.GetByte(0));
        }