1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System;
|
20
|
|
using System.Reflection;
|
21
|
|
using Seasar.Framework.Container;
|
22
|
|
|
23
|
|
namespace Seasar.Framework.Container.Util
|
24
|
|
{
|
25
|
|
|
26
|
|
|
27
|
|
|
28
|
|
public sealed class AutoBindingUtil
|
29
|
|
{
|
30
|
0
|
private AutoBindingUtil()
|
31
|
|
{
|
32
|
|
}
|
33
|
|
|
34
|
27
|
public static bool IsSuitable(ParameterInfo[] parameters)
|
35
|
|
{
|
36
|
27
|
foreach(ParameterInfo parameter in parameters)
|
37
|
|
{
|
38
|
19
|
if(!IsSuitable(parameter.ParameterType))
|
39
|
|
{
|
40
|
3
|
return false;
|
41
|
|
}
|
42
|
|
}
|
43
|
24
|
return true;
|
44
|
|
}
|
45
|
|
|
46
|
819
|
public static bool IsSuitable(Type type)
|
47
|
|
{
|
48
|
819
|
return type.IsInterface;
|
49
|
|
}
|
50
|
|
|
51
|
1127
|
public static bool IsAuto(string mode)
|
52
|
|
{
|
53
|
1127
|
return ContainerConstants.AUTO_BINDING_AUTO.ToLower().Equals(mode.ToLower());
|
54
|
|
}
|
55
|
|
|
56
|
14
|
public static bool IsConstructor(string mode)
|
57
|
|
{
|
58
|
14
|
return ContainerConstants.AUTO_BINDING_CONSTRUCTOR.ToLower().Equals(mode.ToLower());
|
59
|
|
}
|
60
|
|
|
61
|
12
|
public static bool IsProperty(string mode)
|
62
|
|
{
|
63
|
12
|
return ContainerConstants.AUTO_BINDING_PROPERTY.ToLower().Equals(mode.ToLower());
|
64
|
|
}
|
65
|
|
|
66
|
10
|
public static bool IsNone(string mode)
|
67
|
|
{
|
68
|
10
|
return ContainerConstants.AUTO_BINDING_NONE.ToLower().Equals(mode.ToLower());
|
69
|
|
}
|
70
|
|
}
|
71
|
|
}
|
72
|
|
|