Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 91   Methods: 2
NCLOC: 67 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Factory\ComponentTagHandler.cs 68.8% 93.8% 100.0% 86.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.Framework.Xml;
22   using Seasar.Framework.Util;
23   using Seasar.Framework.Container.Impl;
24   using Seasar.Framework.Container.Util;
25  
26   namespace Seasar.Framework.Container.Factory
27   {
28   /// <summary>
29   /// ComponentTagHandler の概要の説明です。
30   /// </summary>
31   public class ComponentTagHandler : TagHandler
32   {
33  
34 655 public override void Start(TagHandlerContext context, IAttributes attributes)
35   {
36 655 IComponentDef componentDef = null;
37 655 string className = attributes["class"];
38 655 Type componentType = null;
39 655 IS2Container container = (IS2Container) context.Peek(0);
40 655 if(className != null)
41   {
42 601 Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
43 601 componentType = ClassUtil.ForName(className,asms);
44 601 if(componentType == null)
45 0 throw new ClassNotFoundRuntimeException(className);
46   }
47 655 string name = attributes["name"];
48 655 componentDef = new ComponentDefImpl(componentType,name);
49 655 string instanceMode = attributes["instance"];
50 655 if(instanceMode != null) componentDef.InstanceMode = instanceMode;
51 655 string autoBindingMode = attributes["autoBinding"];
52 655 if(autoBindingMode != null) componentDef.AutoBindingMode = autoBindingMode;
53 655 context.Push(componentDef);
54   }
55  
56 655 public override void End(TagHandlerContext context, string body)
57   {
58 655 IComponentDef componentDef = (IComponentDef) context.Pop();
59 655 string expression = null;
60 655 if(body != null)
61   {
62 655 expression = body.Trim();
63 655 if(!StringUtil.IsEmpty(expression))
64   {
65 52 componentDef.Expression = expression;
66   }
67   else
68   {
69 603 expression = null;
70   }
71   }
72 655 if(componentDef.ComponentType == null
73   && !InstanceModeUtil.IsOuter(componentDef.InstanceMode)
74   && expression == null)
75   {
76 0 throw new TagAttributeNotDefinedRuntimeException("component","class");
77   }
78 655 if(context.Peek() is IS2Container)
79   {
80 453 IS2Container container = (IS2Container) context.Peek();
81 453 container.Register(componentDef);
82   }
83   else
84   {
85 202 IArgDef argDef = (IArgDef) context.Peek();
86 202 argDef.ChildComponentDef = componentDef;
87   }
88   }
89  
90   }
91   }