- Timestamp:
- 03/15/10 14:45:46 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs
r3031 r3036 11 11 /// Indicates the time at which the hook should be invoked. 12 12 /// </summary> 13 public enum HookType { BeforeSerialization, AfterDeserialization }; 13 public enum HookType { 14 15 /// <summary> 16 /// States that this hook should be called before the storable 17 /// serializer starts decomposing the object. 18 /// </summary> 19 BeforeSerialization, 20 21 /// <summary> 22 /// States that this hook should be called after the storable 23 /// serializer hast complete re-assembled the object. 24 /// </summary> 25 AfterDeserialization }; 14 26 15 27 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r3031 r3036 18 18 /// </summary> 19 19 [StorableClass] 20 public class StorableSerializer : ICompositeSerializer {20 public sealed class StorableSerializer : ICompositeSerializer { 21 21 22 22 #region ICompositeSerializer implementation 23 23 24 /// <summary> 25 /// Priority 200, one of the first default composite serializers to try. 26 /// </summary> 27 /// <value></value> 24 28 public int Priority { 25 29 get { return 200; } 26 30 } 27 31 32 /// <summary> 33 /// Determines for every type whether the composite serializer is applicable. 34 /// </summary> 35 /// <param name="type">The type.</param> 36 /// <returns> 37 /// <c>true</c> if this instance can serialize the specified type; otherwise, <c>false</c>. 38 /// </returns> 28 39 public bool CanSerialize(Type type) { 29 40 if (!ReflectionTools.HasDefaultConstructor(type) && … … 33 44 } 34 45 46 /// <summary> 47 /// Give a reason if possibly why the given type cannot be serialized by this 48 /// ICompositeSerializer. 49 /// </summary> 50 /// <param name="type">The type.</param> 51 /// <returns> 52 /// A string justifying why type cannot be serialized. 53 /// </returns> 35 54 public string JustifyRejection(Type type) { 36 55 if (!ReflectionTools.HasDefaultConstructor(type) && … … 42 61 } 43 62 63 /// <summary> 64 /// Creates the meta info. 65 /// </summary> 66 /// <param name="o">The object.</param> 67 /// <returns>A list of storable components.</returns> 44 68 public IEnumerable<Tag> CreateMetaInfo(object o) { 45 69 InvokeHook(HookType.BeforeSerialization, o); … … 47 71 } 48 72 73 /// <summary> 74 /// Decompose an object into <see cref="Tag"/>s, the tag name can be null, 75 /// the order in which elements are generated is guaranteed to be 76 /// the same as they will be supplied to the Populate method. 77 /// </summary> 78 /// <param name="obj">An object.</param> 79 /// <returns>An enumerable of <see cref="Tag"/>s.</returns> 49 80 public IEnumerable<Tag> Decompose(object obj) { 50 81 foreach (var accessor in GetStorableAccessors(obj)) { … … 55 86 private static readonly object[] defaultArgs = new object[] { true }; 56 87 88 /// <summary> 89 /// Create an instance of the object using the provided meta information. 90 /// </summary> 91 /// <param name="type">A type.</param> 92 /// <param name="metaInfo">The meta information.</param> 93 /// <returns>A fresh instance of the provided type.</returns> 57 94 public object CreateInstance(Type type, IEnumerable<Tag> metaInfo) { 58 95 try { … … 66 103 } 67 104 105 /// <summary> 106 /// Populates the specified instance. 107 /// </summary> 108 /// <param name="instance">The instance.</param> 109 /// <param name="objects">The objects.</param> 110 /// <param name="type">The type.</param> 68 111 public void Populate(object instance, IEnumerable<Tag> objects, Type type) { 69 112 var memberDict = new Dictionary<string, Tag>();
Note: See TracChangeset
for help on using the changeset viewer.