Last change
on this file since 1539 was
1539,
checked in by epitzer, 15 years ago
|
Add Priority property to IDecomposer interface to allow specialized decomposers to be tried first. (#578)
|
File size:
1.6 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using HeuristicLab.Persistence.Core;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Persistence.Interfaces {
|
---|
6 |
|
---|
7 | public interface IDecomposer {
|
---|
8 |
|
---|
9 | /// <summary>
|
---|
10 | /// Defines the Priorty of this Decomposer. Higher number means
|
---|
11 | /// higher prioriy. Negative numbers are fallback decomposers.
|
---|
12 | /// All default generic decomposers 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 decomposer is applicable.
|
---|
20 | /// </summary>
|
---|
21 | bool CanDecompose(Type type);
|
---|
22 |
|
---|
23 | /// <summary>
|
---|
24 | /// Decompose an object into KeyValuePairs, the Key can be null,
|
---|
25 | /// the order in which elements are generated is guaranteed to be
|
---|
26 | /// the same as they are supplied in the Compose method.
|
---|
27 | /// </summary>
|
---|
28 | IEnumerable<Tag> DeCompose(object obj);
|
---|
29 |
|
---|
30 | /// <summary>
|
---|
31 | /// Create an instance of the object if possible. May return null
|
---|
32 | /// in which case the Populate method must create the instance.
|
---|
33 | /// </summary>
|
---|
34 | /// <param name="type"></param>
|
---|
35 | /// <returns></returns>
|
---|
36 | object CreateInstance(Type type);
|
---|
37 |
|
---|
38 | /// <summary>
|
---|
39 | /// Compose an object from the KeyValuePairs previously generated
|
---|
40 | /// in DeCompose. The order in which the values are supplied is
|
---|
41 | /// the same as they where generated. Keys might be null.
|
---|
42 | /// </summary>
|
---|
43 | object Populate(object instance, IEnumerable<Tag> tags, Type type);
|
---|
44 | }
|
---|
45 |
|
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.