All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.event.spi.EventEngineContributions Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha1
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or .
 */
package org.hibernate.event.spi;

import java.util.function.Consumer;

import org.hibernate.event.service.spi.EventListenerGroup;

/**
 * Callback for {@link EventEngineContributor}
 *
 * @author Steve Ebersole
 */
public interface EventEngineContributions {
	/**
	 * Return the EventType by name, if one
	 */
	 EventType findEventType(String name);

	/**
	 * Register a custom event type.
	 *
	 * @apiNote We except the "raw" state rather than an `EventType` instance to account for
	 * the `EventType#ordinal` property.  All registered types must be contiguous, so we handle
	 * the ordinality behind the scenes
	 */
	 EventType contributeEventType(String name, Class listenerRole);

	/**
	 * Register a custom event type with a default listener.
	 */
	 EventType contributeEventType(String name, Class listenerRole, T... defaultListener);

	/**
	 * Perform an action against the listener group for the specified event-type
	 */
	 void configureListeners(EventType eventType, Consumer> action);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy