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

com.fluxtion.api.event.GenericEvent Maven / Gradle / Ivy

/* 
 * Copyright (C) 2018 V12 Technology Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * 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
 * Server Side Public License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program.  If not, see 
 * .
 */
package com.fluxtion.api.event;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * A generic event, where the filter is determined by the class type. An event
 * handler can use the following syntax to receive events filtered by generic
 * type:
 * 
 *   
 * {@code @EventHandler
 *  public void someMethod(GenericEvent event){
 *     //...
 *  }}
 * 
* The generated SEP provide all filtering logic within the generated dispatch. * The Fluxtion compiler analyses the generic type and sets the * {@link #filterString} to the canonical class name of the type. * * @author Greg Higgins ([email protected]) * @param The listener to register */ @Data @EqualsAndHashCode(callSuper = false) public class GenericEvent extends DefaultEvent { public final T value; public GenericEvent(T value) { super(value.getClass().getCanonicalName()); this.value = value; } public GenericEvent(Class valueClass, V value) { super(valueClass.getCanonicalName()); this.value = value; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy