-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIConsumeData.cs
More file actions
31 lines (30 loc) · 1.21 KB
/
IConsumeData.cs
File metadata and controls
31 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Newtonsoft.Json.Linq;
namespace Inversion {
/// <summary>
/// Expresses a type that is able to consume both json and
/// xml representations of itself.
/// </summary>
/// <typeparam name="TBuilder">The type of the builder being used for this type.</typeparam>
/// <typeparam name="TConcrete">The type of the concrete product of consuming data.</typeparam>
public interface IConsumeData<out TBuilder, TConcrete> {
/// <summary>
/// Assigns values to this object based on those
/// of the other object provided.
/// </summary>
/// <param name="other">The other object from which to take values.</param>
/// <returns>Returns a builder populated from the provided concrete object.</returns>
TBuilder FromConcrete(TConcrete other);
/// <summary>
/// Assigns values to this object based on those
/// in the json provided.
/// </summary>
/// <param name="json">The property set from which to take values.</param>
/// <returns>Returns a builded populated from the json provided.</returns>
TBuilder FromJson(JObject json);
/// <summary>
/// Produced a concrete object from this one.
/// </summary>
/// <returns>Returns a concrete object from this one.</returns>
TConcrete ToConcrete();
}
}