Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Interfaces/ICompositeSerializer.cs @ 3010

Last change on this file since 3010 was 2993, checked in by epitzer, 14 years ago

add justifications for rejecting a type for serialization in ICompositeSerializer (#548)

File size: 2.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using HeuristicLab.Persistence.Core;
4
5namespace HeuristicLab.Persistence.Interfaces {
6
7  public interface ICompositeSerializer {
8
9    /// <summary>
10    /// Defines the Priorty of this composite serializer. Higher number means
11    /// higher prioriy. Negative numbers are fallback serializers.
12    /// All default generic composite serializers have priority 100. Specializations
13    /// have priority 200 so they will  be tried first. Priorities are
14    /// only considered for default configurations.
15    /// </summary>
16    int Priority { get; }
17
18    /// <summary>
19    /// Determines for every type whether the composite serializer is applicable.
20    /// </summary>   
21    bool CanSerialize(Type type);
22
23    /// <summary>
24    /// Give a reason if possibly why the given type cannot be serialized by this
25    /// ICompositeSerializer.
26    /// </summary>
27    string JustifyRejection(Type type);
28
29    /// <summary>
30    /// Generate MetaInfo necessary for instance creation. (i.e.
31    /// array dimensions).
32    /// </summary>   
33    IEnumerable<Tag> CreateMetaInfo(object obj);
34
35    /// <summary>
36    /// Decompose an object into KeyValuePairs, the Key can be null,
37    /// the order in which elements are generated is guaranteed to be
38    /// the same as they will be supplied to the Populate method.
39    /// </summary>   
40    IEnumerable<Tag> Decompose(object obj);
41
42    /// <summary>
43    /// Create an instance of the object using the provided meta information.
44    /// </summary>
45    /// <param name="type"></param>
46    /// <returns></returns>
47    object CreateInstance(Type type, IEnumerable<Tag> metaInfo);
48
49    /// <summary>
50    /// Compose an object from the KeyValuePairs previously generated
51    /// in DeCompose. The order in which the values are supplied is
52    /// the same as they where generated. Keys might be null.
53    /// </summary>   
54    void Populate(object instance, IEnumerable<Tag> tags, Type type);
55  }
56
57}
Note: See TracBrowser for help on using the repository browser.