1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.component.internal.multi

File DelegateComponentManager.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart7.png
64% of files have more coverage

Code metrics

0
20
20
1
173
114
20
1
1
20
1

Classes

Class Line # Actions
DelegateComponentManager 39 20 0% 20 12
0.770%
 

Contributing tests

This file is covered by 198 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.component.internal.multi;
21   
22    import java.lang.reflect.Type;
23    import java.util.List;
24    import java.util.Map;
25   
26    import org.xwiki.component.descriptor.ComponentDescriptor;
27    import org.xwiki.component.manager.ComponentEventManager;
28    import org.xwiki.component.manager.ComponentLifecycleException;
29    import org.xwiki.component.manager.ComponentLookupException;
30    import org.xwiki.component.manager.ComponentManager;
31    import org.xwiki.component.manager.ComponentRepositoryException;
32   
33    /**
34    * Delegate all calls to a defined Component Manager, acting as a Proxy for it.
35    *
36    * @version $Id: aa0ebfe106acba857b1476bf058841c49dba1cd1 $
37    * @since 3.3M2
38    */
 
39    public class DelegateComponentManager implements ComponentManager
40    {
41    /**
42    * @see #getComponentManager()
43    */
44    private ComponentManager componentManager;
45   
46    /**
47    * @return the Component Manager to delegate to
48    */
 
49  17029 toggle public ComponentManager getComponentManager()
50    {
51  17034 return this.componentManager;
52    }
53   
54    /**
55    * @param componentManager see {@link #getComponentManager()}
56    */
 
57  185 toggle public void setComponentManager(ComponentManager componentManager)
58    {
59  185 this.componentManager = componentManager;
60    }
61   
 
62  747466 toggle @Override
63    public boolean hasComponent(Type role)
64    {
65  747466 return getComponentManager().hasComponent(role);
66    }
67   
 
68  3777880 toggle @Override
69    public boolean hasComponent(Type role, String hint)
70    {
71  3777892 return getComponentManager().hasComponent(role, hint);
72    }
73   
 
74  737389 toggle @Override
75    public <T> T getInstance(Type roleType) throws ComponentLookupException
76    {
77  737389 return getComponentManager().getInstance(roleType);
78    }
79   
 
80  8738004 toggle @Override
81    public <T> T getInstance(Type roleType, String roleHint) throws ComponentLookupException
82    {
83  8738027 return getComponentManager().getInstance(roleType, roleHint);
84    }
85   
 
86  154799 toggle @Override
87    public <T> List<T> getInstanceList(Type role) throws ComponentLookupException
88    {
89  154809 return getComponentManager().getInstanceList(role);
90    }
91   
 
92  65790 toggle @Override
93    public <T> Map<String, T> getInstanceMap(Type role) throws ComponentLookupException
94    {
95  65792 return getComponentManager().getInstanceMap(role);
96    }
97   
 
98  10297 toggle @Override
99    public <T> ComponentDescriptor<T> getComponentDescriptor(Type role, String hint)
100    {
101  10297 return getComponentManager().getComponentDescriptor(role, hint);
102    }
103   
 
104  60496 toggle @Override
105    public <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Type role)
106    {
107  60496 return getComponentManager().getComponentDescriptorList(role);
108    }
109   
 
110  0 toggle @Override
111    public <T> void registerComponent(ComponentDescriptor<T> componentDescriptor, T componentInstance)
112    throws ComponentRepositoryException
113    {
114  0 getComponentManager().registerComponent(componentDescriptor, componentInstance);
115    }
116   
 
117  0 toggle @Override
118    public <T> void registerComponent(ComponentDescriptor<T> componentDescriptor) throws ComponentRepositoryException
119    {
120  0 getComponentManager().registerComponent(componentDescriptor);
121    }
122   
 
123  18 toggle @Override
124    public void unregisterComponent(Type role, String hint)
125    {
126  18 getComponentManager().unregisterComponent(role, hint);
127    }
128   
 
129  25 toggle @Override
130    public void unregisterComponent(ComponentDescriptor<?> classComponentDescriptor)
131    {
132  25 getComponentManager().unregisterComponent(classComponentDescriptor);
133    }
134   
 
135  7306 toggle @Override
136    public void release(Object component) throws ComponentLifecycleException
137    {
138  7306 getComponentManager().release(component);
139    }
140   
 
141  0 toggle @Override
142    public ComponentEventManager getComponentEventManager()
143    {
144  0 return getComponentManager().getComponentEventManager();
145    }
146   
 
147  0 toggle @Override
148    public void setComponentEventManager(ComponentEventManager eventManager)
149    {
150  0 getComponentManager().setComponentEventManager(eventManager);
151    }
152   
 
153  0 toggle @Override
154    public ComponentManager getParent()
155    {
156  0 return getComponentManager().getParent();
157    }
158   
 
159  0 toggle @Override
160    public void setParent(ComponentManager parentComponentManager)
161    {
162  0 getComponentManager().setParent(parentComponentManager);
163    }
164   
165    // Deprecated
166   
 
167  1 toggle @Override
168    @Deprecated
169    public <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Class<T> role)
170    {
171  1 return getComponentManager().getComponentDescriptorList(role);
172    }
173    }