public sealed override FieldMetadata Read(ObjectContainerBase stream, ClassMetadata containingClass, ByteArrayBuffer reader) { RawFieldSpec spec = ReadSpec(stream, reader); return(FromSpec(spec, stream, containingClass)); }
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; }
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); }
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); }
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); }
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)); }
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; }
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; }