Clover.NET coverage report - Coverage for s2dao.net

Coverage timestamp: 2006年5月18日 15:09:15

File Stats: LOC: 103   Methods: 6
NCLOC: 76 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Dao.Impl\FieldAnnotationReader.cs 80.0% 96.3% 100.0% 93.0%
coverage coverage
1   #region Copyright
2   /*
3   * Copyright 2005 the Seasar Foundation and the Others.
4   *
5   * Licensed under the Apache License, Version 2.0 (the "License");
6   * you may not use this file except in compliance with the License.
7   * You may obtain a copy of the License at
8   *
9   * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14   * either express or implied. See the License for the specific language
15   * governing permissions and limitations under the License.
16   */
17   #endregion
18  
19   using System;
20   using System.Reflection;
21   using Seasar.Dao.Attrs;
22  
23   namespace Seasar.Dao.Impl
24   {
25   public class FieldAnnotationReader : IDaoAnnotationReader
26   {
27   protected Type daoBeanType;
28  
29 18 public FieldAnnotationReader(Type daoBeanType)
30   {
31 18 this.daoBeanType = daoBeanType;
32   }
33  
34   #region IDaoAnnotationReader メンバ
35  
36 38 public string GetQuery(string name)
37   {
38 38 MethodInfo mi = daoBeanType.GetMethod(name);
39 38 QueryAttribute queryAttr = AttributeUtil.GetQueryAttribute(mi);
40 38 if(queryAttr != null)
41   {
42 33 return queryAttr.Query;
43   }
44   else
45   {
46 5 return null;
47   }
48   }
49  
50 18 public Type GetBeanType()
51   {
52 18 BeanAttribute beanAttr = AttributeUtil.GetBeanAttribute(daoBeanType);
53 18 return beanAttr.BeanType;
54   }
55  
56 68 public string[] GetNoPersistentProps(string methodName)
57   {
58 68 MethodInfo mi = daoBeanType.GetMethod(methodName);
59 68 NoPersistentPropsAttribute nppAttr = AttributeUtil.GetNoPersistentPropsAttribute(mi);
60 68 if(nppAttr != null)
61   {
62 14 return nppAttr.Props;
63   }
64   else
65   {
66 54 return null;
67   }
68   }
69  
70 54 public string[] GetPersistentProps(string methodName)
71   {
72 54 MethodInfo mi = daoBeanType.GetMethod(methodName);
73 54 PersistentPropsAttribute ppAttr = AttributeUtil.GetPersistentPropsAttribute(mi);
74 54 if(ppAttr != null)
75   {
76 14 return ppAttr.Props;
77   }
78   else
79   {
80 40 return null;
81   }
82   }
83  
84 116 public string GetSql(string name, IDbms dbms)
85   {
86 116 MethodInfo mi = daoBeanType.GetMethod(name);
87 116 SqlAttribute[] sqlAttrs = AttributeUtil.GetSqlAttributes(mi);
88 116 SqlAttribute defaultSqlAttr = null;
89 116 foreach(SqlAttribute sqlAttr in sqlAttrs)
90   {
91 5 if(sqlAttr.Dbms == dbms.Dbms)
92 0 return sqlAttr.Sql;
93 5 if(sqlAttr.Dbms == KindOfDbms.None)
94 5 defaultSqlAttr = sqlAttr;
95   }
96  
97 116 return defaultSqlAttr == null ? null : defaultSqlAttr.Sql;
98   }
99  
100   #endregion
101   }
102   }
103