Changeset 1419 for branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IDecomposer.cs
- Timestamp:
- 03/25/09 17:16:32 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IDecomposer.cs
r1360 r1419 1 1 using System; 2 2 using System.Collections; 3 using System.Collections.Generic; 3 4 4 5 namespace HeuristicLab.Persistence.Interfaces { 5 6 6 public interface IDecomposer { 7 bool CanDecompose(Type type); 8 IEnumerable DeCompose(object obj); 9 object Compose(IEnumerable objects, Type type); 7 public struct Tag { 8 public string Name; 9 public object Value; 10 public Tag(string name, object value) { 11 Name = name; 12 Value = value; 13 } 14 public Tag(object value) { 15 Name = null; 16 Value = value; 17 } 10 18 } 11 19 20 public interface IDecomposer { 21 22 /// <summary> 23 /// Determines for every type whether the decomposer is applicable. 24 /// </summary> 25 bool CanDecompose(Type type); 26 27 /// <summary> 28 /// Decompose an object into KeyValuePairs, the Key can be null, 29 /// the order in which elements are generated is guaranteed to be 30 /// the same as they are supplied in the Compose method. 31 /// </summary> 32 IEnumerable<Tag> DeCompose(object obj); 33 34 /// <summary> 35 /// Create an instance of the object if possible. May return null 36 /// in which case the Populate method must create the instance. 37 /// </summary> 38 /// <param name="type"></param> 39 /// <returns></returns> 40 object CreateInstance(Type type); 41 42 /// <summary> 43 /// Compose an object from the KeyValuePairs previously generated 44 /// in DeCompose. The order in which the values are supplied is 45 /// the same as they where generated. Keys might be null. 46 /// </summary> 47 object Populate(object instance, IEnumerable<Tag> tags, Type type); 48 } 49 12 50 }
Note: See TracChangeset
for help on using the changeset viewer.