Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 81   Methods: 2
NCLOC: 52 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Assembler\ManualConstructorAssembler.cs 80.0% 83.3% 100.0% 83.3%
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.Framework.Beans;
22   using Seasar.Framework.Container.Util;
23   using Seasar.Framework.Util;
24  
25   namespace Seasar.Framework.Container.Assembler
26   {
27   /// <summary>
28   /// ManualConstructorAssembler の概要の説明です。
29   /// </summary>
30   public class ManualConstructorAssembler : AbstractConstructorAssembler
31   {
32 88 public ManualConstructorAssembler(IComponentDef componentDef)
33   : base(componentDef)
34   {
35   }
36  
37 89 public override object Assemble()
38   {
39 89 object[] args = new object[this.ComponentDef.ArgDefSize];
40  
41 186 for(int i = 0; i < args.Length; ++i)
42   {
43 98 try
44   {
45 98 args[i] = this.ComponentDef.GetArgDef(i).Value;
46   }
47   catch(ComponentNotFoundRuntimeException cause)
48   {
49 0 throw new IllegalConstructorRuntimeException(
50   this.ComponentDef.ComponentType,cause);
51   }
52   }
53  
54 88 ConstructorInfo constructor =
55   this.ComponentDef.ComponentType.GetConstructor(
56   Type.GetTypeArray(args));
57  
58 88 if(constructor == null)
59 0 throw new ConstructorNotFoundRuntimeException(
60   this.ComponentDef.ComponentType, args);
61  
62 88 ParameterInfo[] parameters = constructor.GetParameters();
63  
64 185 for (int i = 0; i < args.Length; ++i)
65   {
66 97 IArgDef argDef = this.ComponentDef.GetArgDef(i);
67 97 object value = this.GetComponentByReceiveType(parameters[i].ParameterType, argDef.Expression);
68 97 if (value != null) args[i] = value;
69   }
70  
71 88 object obj = ConstructorUtil.NewInstance(constructor,args);
72 88 if(this.ComponentDef.ComponentType.IsInterface && this.ComponentDef.AspectDefSize > 0)
73   {
74 0 AopProxyUtil.WeaveAspect(ref obj,this.ComponentDef);
75   }
76 88 return obj;
77   }
78  
79   }
80   }
81