Clover.NET coverage report - Coverage for s2container.net

Coverage timestamp: 2006年5月30日 11:21:29

File Stats: LOC: 94   Methods: 2
NCLOC: 65 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Assembler\AutoPropertyAssembler.cs 100.0% 100.0% 100.0% 100.0%
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 System.Runtime.Remoting;
22   using Seasar.Framework.Aop.Proxy;
23   using Seasar.Framework.Log;
24   using Seasar.Framework.Container.Util;
25  
26   namespace Seasar.Framework.Container.Assembler
27   {
28   /// <summary>
29   /// AutoPropertyAssembler の概要の説明です。
30   /// </summary>
31   public class AutoPropertyAssembler : AbstractPropertyAssembler
32   {
33   private static Logger logger_ = Logger.GetLogger(typeof(AutoPropertyAssembler));
34  
35 466 public AutoPropertyAssembler(IComponentDef componentDef)
36   : base(componentDef)
37   {
38   }
39  
40 468 public override void Assemble(object component)
41   {
42 468 Type type = component.GetType();
43 468 if ( RemotingServices.IsTransparentProxy(component) )
44   {
45 10 AopProxy aopProxy = RemotingServices.GetRealProxy(component) as AopProxy;
46 10 if (aopProxy != null)
47   {
48 2 type = aopProxy.TargetType;
49   }
50   }
51  
52 468 IS2Container container = this.ComponentDef.Container;
53 468 foreach(PropertyInfo property in type.GetProperties())
54   {
55 1179 object value = null;
56 1179 string propName = property.Name;
57 1179 if(this.ComponentDef.HasPropertyDef(propName))
58   {
59 281 IPropertyDef propDef = this.ComponentDef.GetPropertyDef(propName);
60  
61 281 value = this.GetComponentByReceiveType(property.PropertyType, propDef.Expression);
62  
63 281 if(value == null) value = this.GetValue(propDef,component);
64  
65 281 this.SetValue(property,component,value);
66   }
67 898 else if(property.CanWrite
68   && AutoBindingUtil.IsSuitable(property.PropertyType))
69   {
70 314 try
71   {
72 314 value = container.GetComponent(property.PropertyType);
73   }
74   catch(ComponentNotFoundRuntimeException cause)
75   {
76 2 if(property.CanRead
77   && property.GetValue(component,null) != null)
78   {
79 1 continue;
80   }
81 1 logger_.Log("WSSR0008",
82   new object[] {this.GetComponentType(
83   component).FullName, propName},cause);
84 1 continue;
85   }
86 312 this.SetValue(property,component,value);
87   }
88  
89   }
90   }
91  
92   }
93   }
94