forked from shengqh/RCPA.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnnotationPropertyFactory.cs
56 lines (47 loc) · 1.5 KB
/
AnnotationPropertyFactory.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RCPA.Converter;
using RCPA;
namespace RCPA
{
public class AnnotationPropertyFactory : IPropertyConverterFactory<Annotation>
{
private AnnotationPropertyFactory() { }
public static AnnotationPropertyFactory GetInstance()
{
return new AnnotationPropertyFactory();
}
public IPropertyConverter<Annotation> FindConverter(string name)
{
return new AnnotationConverter<Annotation>(name);
}
public IPropertyConverter<Annotation> FindConverter(string name, string version)
{
return new AnnotationConverter<Annotation>(name);
}
public IPropertyConverter<Annotation> GetConverters(string header, char delimiter)
{
string[] parts = header.Split(new char[] { delimiter });
var result = new List<IPropertyConverter<Annotation>>();
foreach (string part in parts)
{
result.Add(FindConverter(part));
}
return new CompositePropertyConverter<Annotation>(result, delimiter);
}
public IPropertyConverter<Annotation> GetConverters(string header, char delimiter, string version)
{
return GetConverters(header, delimiter);
}
public IPropertyConverter<Annotation> GetConverters(string header, char delimiter, string version, List<Annotation> items)
{
return GetConverters(header, delimiter);
}
Annotation IPropertyConverterFactory<Annotation>.Allocate()
{
return new Annotation();
}
}
}