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
|
|
|
22
|
|
namespace Seasar.Dao.Attrs
|
23
|
|
{
|
24
|
|
|
25
|
|
|
26
|
|
|
27
|
|
public sealed class AttributeUtil
|
28
|
|
{
|
29
|
0
|
private AttributeUtil()
|
30
|
|
{
|
31
|
|
}
|
32
|
|
|
33
|
244
|
public static ColumnAttribute GetColumnAttribute(PropertyInfo pi)
|
34
|
|
{
|
35
|
244
|
return Attribute.GetCustomAttribute(pi,
|
36
|
|
typeof(ColumnAttribute)) as ColumnAttribute;
|
37
|
|
}
|
38
|
|
|
39
|
44
|
public static TableAttribute GetTableAttribute(Type type)
|
40
|
|
{
|
41
|
44
|
return Attribute.GetCustomAttribute(type,
|
42
|
|
typeof(TableAttribute)) as TableAttribute;
|
43
|
|
}
|
44
|
|
|
45
|
44
|
public static VersionNoPropertyAttribute GetVersionNoPropertyAttribute(Type type)
|
46
|
|
{
|
47
|
44
|
return Attribute.GetCustomAttribute(type,
|
48
|
|
typeof(VersionNoPropertyAttribute)) as VersionNoPropertyAttribute;
|
49
|
|
}
|
50
|
|
|
51
|
44
|
public static TimestampPropertyAttribute GetTimestampPropertyAttribute(Type type)
|
52
|
|
{
|
53
|
44
|
return Attribute.GetCustomAttribute(type,
|
54
|
|
typeof(TimestampPropertyAttribute)) as TimestampPropertyAttribute;
|
55
|
|
}
|
56
|
|
|
57
|
259
|
public static RelnoAttribute GetRelnoAttribute(PropertyInfo pi)
|
58
|
|
{
|
59
|
259
|
return Attribute.GetCustomAttribute(pi,
|
60
|
|
typeof(RelnoAttribute)) as RelnoAttribute;
|
61
|
|
}
|
62
|
|
|
63
|
257
|
public static IDAttribute GetIDAttribute(PropertyInfo pi)
|
64
|
|
{
|
65
|
257
|
return Attribute.GetCustomAttribute(pi,
|
66
|
|
typeof(IDAttribute)) as IDAttribute;
|
67
|
|
}
|
68
|
|
|
69
|
112
|
public static NoPersistentPropsAttribute GetNoPersistentPropsAttribute(MemberInfo mi)
|
70
|
|
{
|
71
|
112
|
return Attribute.GetCustomAttribute(mi,
|
72
|
|
typeof(NoPersistentPropsAttribute)) as NoPersistentPropsAttribute;
|
73
|
|
}
|
74
|
|
|
75
|
15
|
public static RelkeysAttribute GetRelkeysAttribute(PropertyInfo pi)
|
76
|
|
{
|
77
|
15
|
return Attribute.GetCustomAttribute(pi,
|
78
|
|
typeof(RelkeysAttribute)) as RelkeysAttribute;
|
79
|
|
}
|
80
|
|
|
81
|
18
|
public static BeanAttribute GetBeanAttribute(Type type)
|
82
|
|
{
|
83
|
18
|
return Attribute.GetCustomAttribute(type,
|
84
|
|
typeof(BeanAttribute)) as BeanAttribute;
|
85
|
|
}
|
86
|
|
|
87
|
116
|
public static SqlAttribute[] GetSqlAttributes(MethodInfo mi)
|
88
|
|
{
|
89
|
116
|
return Attribute.GetCustomAttributes(mi,
|
90
|
|
typeof(SqlAttribute)) as SqlAttribute[];
|
91
|
|
}
|
92
|
|
|
93
|
38
|
public static QueryAttribute GetQueryAttribute(MethodInfo mi)
|
94
|
|
{
|
95
|
38
|
return Attribute.GetCustomAttribute(mi,
|
96
|
|
typeof(QueryAttribute)) as QueryAttribute;
|
97
|
|
}
|
98
|
|
|
99
|
54
|
public static PersistentPropsAttribute GetPersistentPropsAttribute(MethodInfo mi)
|
100
|
|
{
|
101
|
54
|
return Attribute.GetCustomAttribute(mi,
|
102
|
|
typeof(PersistentPropsAttribute)) as PersistentPropsAttribute;
|
103
|
|
}
|
104
|
|
}
|
105
|
|
}
|
106
|
|
|