use of io.spine.type.EventClass in project core-java by SpineEventEngine.
the class IdSetFunctions method findAndApply.
/**
* Finds a function for the passed event and applies it.
*
* <p>If there is no function for the passed event applies the default function.
*
* @param event the event message
* @param context the event context
* @return the set of entity IDs
*/
public Set<I> findAndApply(Message event, EventContext context) {
final EventClass eventClass = EventClass.of(event);
final IdSetEventFunction<I, Message> func = map.get(eventClass);
if (func != null) {
final Set<I> result = func.apply(event, context);
return result;
}
final Set<I> result = defaultFunction.apply(event, context);
return result;
}
use of io.spine.type.EventClass in project core-java by SpineEventEngine.
the class IdSetFunctions method remove.
/**
* Removes a function for the passed event class.
*/
public <E extends Message> void remove(Class<E> eventClass) {
final EventClass clazz = EventClass.of(eventClass);
map.remove(clazz);
}
Aggregations