Changeset 6222 for branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
- Timestamp:
- 05/17/11 14:41:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r6214 r6222 41 41 public sealed class StorableSerializer : ICompositeSerializer { 42 42 43 private StorableClassAnalyzer analyzer; 44 45 public StorableSerializer() { 46 analyzer = new StorableClassAnalyzer(); 47 } 43 public StorableSerializer() { } 48 44 49 45 [StorableConstructor] … … 68 64 /// </returns> 69 65 public bool CanSerialize(Type type) { 70 TypeDescriptor desc = analyzer[type];66 TypeDescriptor desc = StorableClassAnalyzer.GetDescriptor(type); 71 67 if (desc.IsInvalid) 72 68 return false; … … 91 87 public string JustifyRejection(Type type) { 92 88 StringBuilder sb = new StringBuilder(); 93 TypeDescriptor desc = analyzer[type];89 TypeDescriptor desc = StorableClassAnalyzer.GetDescriptor(type); 94 90 if (desc.IsInvalid) 95 91 sb.Append("class is not marked [StorableClass] but has mutable members."); … … 120 116 /// <returns>An enumerable of <see cref="Tag"/>s.</returns> 121 117 public IEnumerable<Tag> Decompose(object obj) { 122 foreach (var kvp in analyzer[obj.GetType()].Decompose(obj)) {118 foreach (var kvp in StorableClassAnalyzer.GetDescriptor(obj.GetType()).Decompose(obj)) { 123 119 yield return new Tag(kvp.Key, kvp.Value); 124 120 } … … 133 129 public object CreateInstance(Type type, IEnumerable<Tag> metaInfo) { 134 130 try { 135 return analyzer[type].CreateInstance();131 return StorableClassAnalyzer.GetDescriptor(type).CreateInstance(); 136 132 } catch (TargetInvocationException x) { 137 133 throw new PersistenceException( … … 148 144 /// <param name="type">The type.</param> 149 145 public void Populate(object instance, IEnumerable<Tag> objects, Type type) { 150 analyzer[type].Populate(instance, objects.ToDictionary(kvp => kvp.Name, kvp => kvp.Value));146 StorableClassAnalyzer.GetDescriptor(type).Populate(instance, objects.ToDictionary(kvp => kvp.Name, kvp => kvp.Value)); 151 147 } 152 148
Note: See TracChangeset
for help on using the changeset viewer.