/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2011, Red Hat Inc. or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Inc.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.hibernate.event.service.spi;

import java.io.Serializable;

import org.hibernate.event.spi.EventType;

Contract for a groups of events listeners for a particular event type.
Author:Steve Ebersole
/** * Contract for a groups of events listeners for a particular event type. * * @author Steve Ebersole */
public interface EventListenerGroup<T> extends Serializable {
Retrieve the event type associated with this groups of listeners.
Returns:The event type.
/** * Retrieve the event type associated with this groups of listeners. * * @return The event type. */
public EventType<T> getEventType();
Are there no listeners registered?
Returns:true if no listeners are registered; false otherwise.
/** * Are there no listeners registered? * * @return {@literal true} if no listeners are registered; {@literal false} otherwise. */
public boolean isEmpty(); public int count(); public Iterable<T> listeners();
Mechanism to more finely control the notion of duplicates.

For example, say you are registering listeners for an extension library. This extension library could define a "marker interface" which indicates listeners related to it and register a strategy that checks against that marker interface.
Params:
  • strategy – The duplication strategy
/** * Mechanism to more finely control the notion of duplicates. * <p/> * For example, say you are registering listeners for an extension library. This extension library * could define a "marker interface" which indicates listeners related to it and register a strategy * that checks against that marker interface. * * @param strategy The duplication strategy */
public void addDuplicationStrategy(DuplicationStrategy strategy); public void appendListener(T listener); public void appendListeners(T... listeners); public void prependListener(T listener); public void prependListeners(T... listeners); public void clear(); }