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

com.sap.cds.services.impl.EventPredicate Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
/**************************************************************************
 * (C) 2019-2024 SAP SE or an SAP affiliate company. All rights reserved. *
 **************************************************************************/
package com.sap.cds.services.impl;

import com.sap.cds.services.Service;
import com.sap.cds.services.handler.Handler;

/**
 * Functional interface to filter for certain events and entities, when registering {@link Handler} instances on {@link Service} instances.
 */
@FunctionalInterface
public interface EventPredicate {

	/**
	 * {@link EventPredicate}, which always evaluates to true
	 */
	public static final EventPredicate ALL = (String event, String entity) -> true;

	/**
	 * Returns true, if a given event and entity should be handled by the {@link Handler} registered with this {@link EventPredicate}
	 * @param event the event
	 * @param entity the entity
	 * @return true, if the given event and entity should be handled, false otherwise
	 */
	public boolean test(String event, String entity);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy