CollectionWithIdsSerializerBase Class
Namespace: Stride.Core.Yaml
Assembly: Stride.Core.Assets.dll
A base class to serialize collections with unique identifiers for each item.
System.Object → Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer → Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer →
CollectionWithIdsSerializerBase
[YamlSerializerFactory(new string[]{"Assets"})]
public abstract class CollectionWithIdsSerializerBase : DictionarySerializer, IYamlSerializable, IYamlSerializableFactory
Name |
Description |
Fields
|
|
DeletedItemsKey |
A key that identifies deleted items during deserialization.
|
|
InstanceInfoKey |
A key that identifies the information about the instance that we need the store in the Stride.Core.Yaml.Serialization.ObjectContext.Properties dictionary.
|
|
NonIdentifiableCollectionItemsKey |
A property key to indicate whether a collection has non-identifiable items
|
|
YamlDeletedKey |
A string token to identify deleted items in a collection.
|
Methods
|
|
AreCollectionItemsIdentifiable(ref ObjectContext) |
|
|
CheckIsSequence(ref ObjectContext) |
|
|
CreatEmptyContainer(ITypeDescriptor) |
Creates an empty dictionary that can store the mapping of ids to items of the collection.
|
|
CreateOrTransformObject(ref ObjectContext) |
|
|
ReadDeletedDictionaryItem(ref ObjectContext, Object) |
|
|
ReadDictionaryItem(ref ObjectContext, KeyValuePair<Type, Type>) |
|
|
ReadDictionaryItems(ref ObjectContext) |
Reads the dictionary items key-values.
|
|
ReadYaml(ref ObjectContext) |
|
|
ReadYamlAfterTransform(ref ObjectContext, Boolean) |
|
|
TransformAfterDeserialization(IDictionary, ITypeDescriptor, Object, ICollection<ItemId>) |
Transforms a dictionary containing the mapping of ids to items into the actual collection, and store the ids in the Stride.Core.Reflection.ShadowObject.
|
|
TransformForSerialization(ITypeDescriptor, Object) |
|
|
WriteDeletedItems(ref ObjectContext) |
|
|
WriteDictionaryItems(ref ObjectContext) |
|
|
WriteYaml(ref ObjectContext) |
|
|
WriteYamlAfterTransform(ref ObjectContext, Boolean) |
|
|
Improve this Doc
View Source
Fields
DeletedItemsKey
A key that identifies deleted items during deserialization.
protected static readonly PropertyKey<ICollection<ItemId>> DeletedItemsKey
Field Value
InstanceInfoKey
A key that identifies the information about the instance that we need the store in the Stride.Core.Yaml.Serialization.ObjectContext.Properties dictionary.
protected static readonly PropertyKey<CollectionWithIdsSerializerBase.InstanceInfo> InstanceInfoKey
Field Value
NonIdentifiableCollectionItemsKey
A property key to indicate whether a collection has non-identifiable items
public static readonly PropertyKey<bool> NonIdentifiableCollectionItemsKey
Field Value
YamlDeletedKey
A string token to identify deleted items in a collection.
public const string YamlDeletedKey = "~(Deleted)"
Field Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
Methods
AreCollectionItemsIdentifiable(ref ObjectContext)
protected static bool AreCollectionItemsIdentifiable(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Returns
Type |
Description |
System.Boolean |
|
CheckIsSequence(ref ObjectContext)
protected override bool CheckIsSequence(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.CheckIsSequence(Stride.Core.Yaml.Serialization.ObjectContext)
CreatEmptyContainer(ITypeDescriptor)
Creates an empty dictionary that can store the mapping of ids to items of the collection.
protected abstract IDictionary CreatEmptyContainer(ITypeDescriptor descriptor)
Parameters
Type |
Name |
Description |
Stride.Core.Reflection.ITypeDescriptor |
descriptor |
The type descriptor of the collection for which to create the dictionary.
|
Returns
Type |
Description |
System.Collections.IDictionary |
An empty dictionary for mapping ids to elements.
|
CreateOrTransformObject(ref ObjectContext)
protected override void CreateOrTransformObject(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.CreateOrTransformObject(Stride.Core.Yaml.Serialization.ObjectContext)
ReadDeletedDictionaryItem(ref ObjectContext, Object)
protected abstract KeyValuePair<object, object> ReadDeletedDictionaryItem(ref ObjectContext objectContext, object keyResult)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
System.Object |
keyResult |
|
Returns
Type |
Description |
System.Collections.Generic.KeyValuePair<System.Object, System.Object> |
|
ReadDictionaryItem(ref ObjectContext, KeyValuePair<Type, Type>)
protected override KeyValuePair<object, object> ReadDictionaryItem(ref ObjectContext objectContext, KeyValuePair<Type, Type> keyValueTypes)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
System.Collections.Generic.KeyValuePair<System.Type, System.Type> |
keyValueTypes |
|
Returns
Type |
Description |
System.Collections.Generic.KeyValuePair<System.Object, System.Object> |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.ReadDictionaryItem(Stride.Core.Yaml.Serialization.ObjectContext, System.Collections.Generic.KeyValuePair<System.Type, System.Type>)
ReadDictionaryItems(ref ObjectContext)
Reads the dictionary items key-values.
protected override void ReadDictionaryItems(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.ReadDictionaryItems(Stride.Core.Yaml.Serialization.ObjectContext)
ReadYaml(ref ObjectContext)
public override object ReadYaml(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Returns
Type |
Description |
System.Object |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.ReadYaml(Stride.Core.Yaml.Serialization.ObjectContext)
ReadYamlAfterTransform(ref ObjectContext, Boolean)
protected virtual void ReadYamlAfterTransform(ref ObjectContext objectContext, bool transformed)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
System.Boolean |
transformed |
|
Transforms a dictionary containing the mapping of ids to items into the actual collection, and store the ids in the Stride.Core.Reflection.ShadowObject.
protected abstract void TransformAfterDeserialization(IDictionary container, ITypeDescriptor targetDescriptor, object targetCollection, ICollection<ItemId> deletedItems = null)
Parameters
Type |
Name |
Description |
System.Collections.IDictionary |
container |
The dictionary mapping ids to item.
|
Stride.Core.Reflection.ITypeDescriptor |
targetDescriptor |
The type descriptor of the actual collection to fill.
|
System.Object |
targetCollection |
The instance of the actual collection to fill.
|
System.Collections.Generic.ICollection<ItemId> |
deletedItems |
A collection of items that are marked as deleted. Can be null.
|
protected abstract object TransformForSerialization(ITypeDescriptor descriptor, object collection)
Parameters
Type |
Name |
Description |
Stride.Core.Reflection.ITypeDescriptor |
descriptor |
|
System.Object |
collection |
|
Returns
Type |
Description |
System.Object |
|
WriteDeletedItems(ref ObjectContext)
protected abstract void WriteDeletedItems(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
WriteDictionaryItems(ref ObjectContext)
protected override void WriteDictionaryItems(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.WriteDictionaryItems(Stride.Core.Yaml.Serialization.ObjectContext)
WriteYaml(ref ObjectContext)
public override void WriteYaml(ref ObjectContext objectContext)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
Overrides
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.WriteYaml(Stride.Core.Yaml.Serialization.ObjectContext)
WriteYamlAfterTransform(ref ObjectContext, Boolean)
protected virtual void WriteYamlAfterTransform(ref ObjectContext objectContext, bool transformed)
Parameters
Type |
Name |
Description |
Stride.Core.Yaml.Serialization.ObjectContext |
objectContext |
|
System.Boolean |
transformed |
|
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.TryCreate(Stride.Core.Yaml.Serialization.SerializerContext, Stride.Core.Reflection.ITypeDescriptor)
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.ReadMember(Stride.Core.Yaml.Serialization.ObjectContext)
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.WriteMembers(Stride.Core.Yaml.Serialization.ObjectContext)
Stride.Core.Yaml.Serialization.Serializers.DictionarySerializer.WriteDictionaryItem(Stride.Core.Yaml.Serialization.ObjectContext, System.Collections.Generic.KeyValuePair<System.Object, System.Object>, System.Collections.Generic.KeyValuePair<System.Type, System.Type>)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.GetStyle(Stride.Core.Yaml.Serialization.ObjectContext)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.TransformObjectAfterRead(Stride.Core.Yaml.Serialization.ObjectContext)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.ReadMembers<TStart, TEnd>(Stride.Core.Yaml.Serialization.ObjectContext)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.TryReadMember(Stride.Core.Yaml.Serialization.ObjectContext, System.String)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.TryReadMember(Stride.Core.Yaml.Serialization.ObjectContext, Stride.Core.Yaml.Events.Scalar, System.String)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.ReadMemberName(Stride.Core.Yaml.Serialization.ObjectContext, System.String, System.Boolean)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.ReadMemberValue(Stride.Core.Yaml.Serialization.ObjectContext, Stride.Core.Reflection.IMemberDescriptor, System.Object, System.Type)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.WriteMember(Stride.Core.Yaml.Serialization.ObjectContext, Stride.Core.Reflection.IMemberDescriptor)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.WriteMemberName(Stride.Core.Yaml.Serialization.ObjectContext, Stride.Core.Reflection.IMemberDescriptor, System.String)
Stride.Core.Yaml.Serialization.Serializers.ObjectSerializer.WriteMemberValue(Stride.Core.Yaml.Serialization.ObjectContext, Stride.Core.Reflection.IMemberDescriptor, System.Object, System.Type)
Extension Methods