    001    package com.hammurapi.eventbus;
    002
    003    /**
    004     * This class delegates to another event handler. The class is initialized from the master handler. Initialization parameters
    005     * can be changed afterwards.
    006     * @author Pavel Vlasov
    007     *
    008     * @param <E>
    009     * @param <P>
    010     * @param <C>
    011     * @param <H>
    012     * @param <S>
    013     */
    014    public class EventHandlerFilter<E, P extends Comparable<P>, C, H extends EventBus.Handle<E,P,C>, S extends EventStore<E,P,C,H,S>> extends AbstractEventHandler<E, P, C, H, S> {
    015
    016            private EventHandler<E, P, C, H, S> master;
    017
    018            public EventHandlerFilter(EventHandler<E,P,C,H,S> master) {
    019                    super(
    020                                    master.getCardinality(),
    021                                    master.getPriority(),
    022                                    master.getContext(),
    023                                    master.consumes(),
    024                                    master.isOneOff(),
    025                                    master.getMode(),
    026                                    master.getPredicate());
    027
    028                    this.master = master;
    029            }
    030
    031            @Override
    032            public void post(EventDispatchContext<E, P, C, H, S> context, E... events) {
    033                    master.post(context, events);
    034            }
    035
    036            public EventHandler<E, P, C, H, S> getMaster() {
    037                    return master;
    038            }
    039
    040    }