EMMA Coverage Report (generated Thu Jan 20 11:39:44 EST 2011)
[all classes][com.hammurapi.eventbus]

COVERAGE SUMMARY FOR SOURCE FILE [Introspector.java]

nameclass, %method, %block, %line, %
Introspector.java100% (1/1)100% (2/2)100% (32/32)100% (6/6)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Introspector100% (1/1)100% (2/2)100% (32/32)100% (6/6)
Introspector (ClassLoader, TokenExpander): void 100% (1/1)100% (5/5)100% (2/2)
bind (Object, EventBus): Set 100% (1/1)100% (27/27)100% (4/4)

1package com.hammurapi.eventbus;
2 
3import java.util.HashSet;
4import java.util.Set;
5 
6import com.hammurapi.common.TokenExpander;
7 
8/**
9 * This class introspects instances passed to it and creates event handlers from 
10 * classes annotated with Handler annotation.
11 * @author Pavel Vlasov
12 *
13 * @param <E> Event type.
14 * @param <P> Priority type.
15 * @param <C> Context type.
16 * @param <K> Registration key type.
17 */
18public class Introspector<E, C, K, H extends EventBus.Handle<E,Integer,C>, S extends EventStore<E,Integer,C,H,S>, B extends EventBus<E, Integer, C, K, H, S>> extends ReflectiveEventHandlerFactory<E, C, H, S> implements JavaBinder<E, C, K, H, S, B, C> {
19        
20        public Introspector(ClassLoader classLoader, TokenExpander tokenExpander) {
21                super(classLoader, tokenExpander);
22        }
23        
24        /**
25         * Registers instance methods annotated with Handler annotation with the bus.
26         * @param instance Instance with handler methods.
27         * @param bus Event bus.
28         * @return Set of registration keys.
29         */
30        @Override
31        public Set<K> bind(final C instance, B bus) {
32                Set<K> ret = new HashSet<K>();                
33                for (ReflectiveEventHandler<E,C,H,S> handler: createHandlers(instance, bus.getEventType())) {
34                        ret.add(bus.addHandler(handler));
35                }
36                return ret;
37        }
38}

[all classes][com.hammurapi.eventbus]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov