Clover.NET coverage report - Coverage for s2container.net

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

File Stats: LOC: 79   Methods: 6
NCLOC: 49 Classes: 1
 
Source File Conditionals Statements Methods TOTAL
Seasar.Framework.Container\Deployer\SingletonComponentDeployer.cs 66.7% 88.9% 100.0% 86.7%
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 Seasar.Framework.Container.Util;
21  
22   namespace Seasar.Framework.Container.Deployer
23   {
24   /// <summary>
25   /// SingletonComponentDeployer の概要の説明です。
26   /// </summary>
27   public class SingletonComponentDeployer : AbstractComponentDeployer
28   {
29   private object component_;
30   private bool instantiating_ = false;
31  
32 447 public SingletonComponentDeployer(IComponentDef componentDef)
33   : base(componentDef)
34   {
35   }
36  
37 829 public override object Deploy(Type receiveType)
38   {
39 829 lock(this)
40   {
41 829 if(component_ == null) this.Assemble();
42  
43 828 object proxy = GetProxy(receiveType);
44 828 return proxy == null ? component_ : proxy;
45   }
46   }
47  
48 1 public override void InjectDependency(object outerComponent)
49   {
50 1 throw new NotSupportedException("InjectDependency");
51   }
52  
53 446 private void Assemble()
54   {
55 0 if(instantiating_) throw new CyclicReferenceRuntimeException(
56   this.ComponentDef.ComponentType);
57 446 instantiating_ = true;
58 446 component_ = this.ConstructorAssembler.Assemble();
59 445 instantiating_ = false;
60 445 this.PropertyAssembler.Assemble(component_);
61 445 this.InitMethodAssembler.Assemble(component_);
62   }
63  
64 180 public override void Init()
65   {
66 180 this.Deploy(ComponentDef.ComponentType);
67   }
68  
69 139 public override void Destroy()
70   {
71 0 if(component_ == null) return;
72 139 this.DestroyMethodAssembler.Assemble(component_);
73 139 component_ = null;
74   }
75  
76  
77   }
78   }
79