com.fluxtion.ext.streaming.api.GenericEventHandler 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.ext.streaming.api;
import com.fluxtion.api.FilteredEventHandler;
import com.fluxtion.api.event.Event;
import com.fluxtion.api.event.GenericEvent;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
/**
*
* EventHandler for {@link GenericEvent}'s. GeneriEvents can wrap any type of
* Object, thus allowing non-fluxtion {@link Event}'s to be handled as an entry
* point in a SEP.
*
*
*
{@inheritDoc}
*/
@RequiredArgsConstructor
@EqualsAndHashCode(of = {"filterString"})
public final class GenericEventHandler, W> implements FilteredEventHandler {
private final String filterString;
public T event;
// public GenericEventHandler(Class eventClass) {
// this.filterString = eventClass.getCanonicalName();
// }
@Override
public int filterId() {
return Event.NO_INT_FILTER;
}
@Override
public String filterString() {
return filterString;
}
@Override
public void onEvent(T e) {
this.event = e;
}
@Override
public Class eventClass() {
return (Class) event.getClass();
}
public W event() {
return event.value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy