public Int64Serializer(AqlaSerializer.Meta.TypeModel model) { #if FEAT_IKVM expectedType = model.MapType(typeof(long)); #endif }
public DoubleSerializer(AqlaSerializer.Meta.TypeModel model) { #if FEAT_IKVM expectedType = model.MapType(typeof(double)); #endif }
public StringSerializer(AqlaSerializer.Meta.TypeModel model) { #if FEAT_IKVM expectedType = model.MapType(typeof(string)); #endif }
internal void FinalizeSettingsValue() { if (_settingsValueFinalSet) { return; } int opaqueToken = 0; try { _model.TakeLock(ref opaqueToken); if (_settingsValueFinalSet) { return; } _settingsValueFinal = _settingsValueByClient; ThrowIfInvalidSettings(_settingsValueFinal); FinalizingOwnSettings?.Invoke(this, new FinalizingOwnSettingsArgs(this)); ThrowIfInvalidSettings(_settingsValueFinal); MemberLevelSettingsValue m = _settingsValueFinal.Member; if (_settingsValueFinal.EnumPassthru == null && Helpers.IsEnum(Type)) { #if WINRT _settingsValueFinal.EnumPassthru = _typeInfo.IsDefined(typeof(FlagsAttribute), false); #else _settingsValueFinal.EnumPassthru = Type.IsDefined(_model.MapType(typeof(FlagsAttribute)), false); #endif } if (_settingsValueFinal.IgnoreListHandling) { m.Collection.ItemType = null; m.Collection.Format = CollectionFormat.NotSpecified; m.Collection.PackedWireTypeForRead = null; } else if (m.Collection.ItemType == null) { m.Collection.ItemType = Type.IsArray ? Type.GetElementType() : TypeModel.GetListItemType(_model, Type); } m.Collection.ConcreteType = _settingsValueFinal.ConstructType; if (_settingsValueFinal.PrefixLength == null && !IsSimpleValue) { _settingsValueFinal.PrefixLength = true; } _settingsValueFinal.Member = m; Helpers.MemoryBarrier(); _settingsValueFinalSet = true; IsFrozen = true; } finally { _model.ReleaseLock(opaqueToken); } }
public DecimalSerializer(AqlaSerializer.Meta.TypeModel model) { #if FEAT_IKVM expectedType = model.MapType(typeof(decimal)); #endif }
internal static void ResolveListTypes(RuntimeTypeModel model, Type type, ref Type itemType, ref Type defaultType) { if (type == null) { return; } if (Helpers.GetTypeCode(type) != ProtoTypeCode.Unknown) { return; // don't try this[type] for inbuilts } // handle arrays if (type.IsArray) { itemType = type.GetElementType(); if (itemType == model.MapType(typeof(byte))) { defaultType = itemType = null; } else { defaultType = type; } } // handle lists if (itemType == null) { itemType = TypeModel.GetListItemType(model, type); } if (itemType != null && defaultType == null) { #if WINRT TypeInfo typeInfo = type.GetTypeInfo(); if (typeInfo.IsClass && !typeInfo.IsAbstract && Helpers.GetConstructor(typeInfo, Helpers.EmptyTypes, true) != null) #else if (type.IsClass && !type.IsAbstract && Helpers.GetConstructor(type, Helpers.EmptyTypes, true) != null) #endif { defaultType = type; } if (defaultType == null) { #if WINRT if (typeInfo.IsInterface) #else if (type.IsInterface) #endif { #if NO_GENERICS defaultType = typeof(ArrayList); #else Type[] genArgs; #if WINRT if (typeInfo.IsGenericType && type.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IDictionary <,>) && itemType == typeof(System.Collections.Generic.KeyValuePair <,>).MakeGenericType(genArgs = typeInfo.GenericTypeArguments)) #else if (type.IsGenericType && type.GetGenericTypeDefinition() == model.MapType(typeof(System.Collections.Generic.IDictionary <,>)) && itemType == model.MapType(typeof(System.Collections.Generic.KeyValuePair <,>)).MakeGenericType(genArgs = type.GetGenericArguments())) #endif { defaultType = model.MapType(typeof(System.Collections.Generic.Dictionary <,>)).MakeGenericType(genArgs); } else { defaultType = model.MapType(typeof(System.Collections.Generic.List <>)).MakeGenericType(itemType); } #endif } } // verify that the default type is appropriate if (defaultType != null && !Helpers.IsAssignableFrom(type, defaultType)) { defaultType = null; } } }
public override T GetRuntimeAttribute <T>(TypeModel model) { return((T)Target); }
public override T GetRuntimeAttribute <T>(TypeModel model) { return((T)(_runtime ?? (_runtime = IKVMAttributeFactory.Create(attribute)))); }
public abstract T GetRuntimeAttribute <T>(TypeModel model);