Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CEDMA-Exporter-715/sources/HeuristicLab.Persistence/3.3/Interfaces/ICompositeSerializer.cs @ 3199

Last change on this file since 3199 was 1823, checked in by epitzer, 16 years ago

Namespace refactoring: rename formatters & decomposers -> primitive and composite serializers. (#603)

File size: 1.8 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    /// Generate MetaInfo necessary for instance creation. (i.e.
25    /// array dimensions).
26    /// </summary>   
27    IEnumerable<Tag> CreateMetaInfo(object obj);
28
29    /// <summary>
30    /// Decompose an object into KeyValuePairs, the Key can be null,
31    /// the order in which elements are generated is guaranteed to be
32    /// the same as they will be supplied to the Populate method.
33    /// </summary>   
34    IEnumerable<Tag> Decompose(object obj);
35
36    /// <summary>
37    /// Create an instance of the object using the provided meta information.
38    /// </summary>
39    /// <param name="type"></param>
40    /// <returns></returns>
41    object CreateInstance(Type type, IEnumerable<Tag> metaInfo);
42
43    /// <summary>
44    /// Compose an object from the KeyValuePairs previously generated
45    /// in DeCompose. The order in which the values are supplied is
46    /// the same as they where generated. Keys might be null.
47    /// </summary>   
48    void Populate(object instance, IEnumerable<Tag> tags, Type type);
49  }
50
51}
Note: See TracBrowser for help on using the repository browser.