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

File ComponentDescriptorAddedEvent.java

 

Coverage histogram

../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

2
8
6
1
98
35
7
0.88
1.33
6
1.17

Classes

Class Line # Actions
ComponentDescriptorAddedEvent 37 8 0% 7 2
0.87587.5%
 

Contributing tests

This file is covered by 133 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.event;
21   
22    import java.lang.reflect.Type;
23   
24    /**
25    * Event sent to tell that a new Component Descriptor has been registered.
26    * <p>
27    * The event also send the following parameters:
28    * </p>
29    * <ul>
30    * <li>source: the {@link org.xwiki.component.manager.ComponentManager} where the component was registered</li>
31    * <li>data: the {@link org.xwiki.component.descriptor.ComponentDescriptor} instance</li>
32    * </ul>
33    *
34    * @version $Id: cd27bcf22894c3b051a28b1cb80714747991102d $
35    * @since 2.6RC2
36    */
 
37    public class ComponentDescriptorAddedEvent extends AbstractComponentDescriptorEvent
38    {
39    /**
40    * Watches all roles (whenever a component is added it'll trigger this event).
41    */
 
42  205 toggle public ComponentDescriptorAddedEvent()
43    {
44   
45    }
46   
47    /**
48    * @param role the component role to watch (all components matching this role will trigger this event)
49    * @deprecated since 4.4RC1 use {@link #ComponentDescriptorAddedEvent(Type)} instead
50    */
 
51  112 toggle @Deprecated
52    public ComponentDescriptorAddedEvent(Class<?> role)
53    {
54  112 super(role);
55    }
56   
57    /**
58    * @param roleType the component role to watch (all components matching this role will trigger this event)
59    * @since 4.4RC1
60    */
 
61  5 toggle public ComponentDescriptorAddedEvent(Type roleType)
62    {
63  5 super(roleType);
64    }
65   
66    /**
67    * @param role the component role to watch
68    * @param roleHint the component role hint to watch
69    * @deprecated since 4.4RC1 use {@link #ComponentDescriptorAddedEvent(Type, String)} instead
70    */
 
71  0 toggle @Deprecated
72    public ComponentDescriptorAddedEvent(Class<?> role, String roleHint)
73    {
74  0 super(role, roleHint);
75    }
76   
77    /**
78    * @param roleType the component role to watch
79    * @param roleHint the component role hint to watch
80    * @since 4.4RC1
81    */
 
82  12313 toggle public ComponentDescriptorAddedEvent(Type roleType, String roleHint)
83    {
84  12313 super(roleType, roleHint);
85    }
86   
 
87  1901 toggle @Override
88    public boolean matches(Object otherEvent)
89    {
90  1901 boolean result = false;
91   
92  1901 if (ComponentDescriptorAddedEvent.class.isAssignableFrom(otherEvent.getClass())) {
93  1900 result = super.matches(otherEvent);
94    }
95   
96  1901 return result;
97    }
98    }