Changeset 1419 for branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs
- Timestamp:
- 03/25/09 17:16:32 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs
r1362 r1419 3 3 using HeuristicLab.Persistence.Interfaces; 4 4 5 namespace HeuristicLab.Persistence.Core { 6 5 namespace HeuristicLab.Persistence.Core { 7 6 8 7 struct ParentReference { } … … 19 18 20 19 public object Obj { get; private set; } 21 public readonly List<object> customValues;20 public List<Tag> customValues; 22 21 23 22 public CustomComposite(object obj) { 24 23 Obj = obj; 25 customValues = new List< object>();24 customValues = new List<Tag>(); 26 25 } 27 26 28 public void AddValue( object value) {29 customValues.Add( value);27 public void AddValue(string name, object value) { 28 customValues.Add(new Tag(name, value)); 30 29 } 31 30 32 public Setter GetSetter(string name) { 31 public Setter GetSetter(string name) { 33 32 int index = customValues.Count - 1; 34 return value => customValues[index] = value; 33 Tag t = customValues[index]; 34 return value => t.Value = value; 35 35 } 36 36 } … … 122 122 if ( serializerMapping.ContainsKey(type) ) 123 123 decomposer = serializerMapping[type] as IDecomposer; 124 if (decomposer != null) { 125 instance = new ParentReference(); 124 if (decomposer != null) { 125 instance = decomposer.CreateInstance(type); 126 if (instance == null) 127 instance = new ParentReference(); 126 128 parentStack.Push(new CustomComposite(instance)); 127 129 } else { … … 143 145 if (decomposer != null) { 144 146 CustomComposite customComposite = (CustomComposite)parentStack.Pop(); 145 object deserializedObject = 146 decomposer. Compose(customComposite.customValues, type);147 object deserializedObject = 148 decomposer.Populate(customComposite.Obj, customComposite.customValues, type); 147 149 if ( end.Id != null ) 148 150 id2obj[(int)end.Id] = deserializedObject; … … 188 190 ((StorableComposite)accessibleObject).SetValue(name, value); 189 191 } else if (accessibleObject is CustomComposite) { 190 ((CustomComposite)accessibleObject).AddValue( value);192 ((CustomComposite)accessibleObject).AddValue(name, value); 191 193 } 192 194 }
Note: See TracChangeset
for help on using the changeset viewer.