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

com.github.edgar615.util.eventbus.HandlerBinding Maven / Gradle / Ivy

There is a newer version: 1.0.11
Show newest version
package com.github.edgar615.util.eventbus;

import com.github.edgar615.util.event.Event;

import java.util.function.BiPredicate;

/**
 * Created by Edgar on 2017/4/12.
 *
 * @author Edgar  Date 2017/4/12
 */
class HandlerBinding {

  private final BiPredicate predicate;

  private final EventHandler eventHandler;

  HandlerBinding(BiPredicate predicate, EventHandler eventHandler) {
    this.predicate = predicate;
    this.eventHandler = eventHandler;
  }

  public boolean match(Event event) {
    return predicate.test(event.head().to(), event.action().resource());
  }

  public EventHandler eventHandler() {
    return eventHandler;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy