    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *     http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.configuration2.event;
    018
    019/**
    020 * <p>
    021 * Definition of a generic event listener interface.
    022 * </p>
    023 * <p>
    024 * This event listener interface is used throughout the
    025 * <em>Commons Configuration</em> library for reacting on all kinds of supported
    026 * events. The interface is pretty minimalistic, defining only a single
    027 * {@code onEvent()} method. This simplifies the implementation of custom event
    028 * listeners and also supports the new language features introduced with Java 8
    029 * ({@code EventListener} is a functional interface and thus can be represented
    030 * by a Lambda expression).
    031 * </p>
    032 *
    033 * @since 2.0
    034 * @param <T> the type of events this listener can process
    035 */
    036public interface EventListener<T extends Event>
    037{
    038    /**
    039     * Notifies this event listener about the arrival of a new event. Typically,
    040     * event listeners are registered at an event source providing an
    041     * {@link EventType}. This event type acts as a filter; all events matched
    042     * by the filter are passed to the listener. The type parameters defined by
    043     * the {@code EventType} class and this interface guarantee that the events
    044     * delivered to the handler are compatible with the concrete method
    045     * signature of {@code onEvent()}.
    046     *
    047     * @param event the event
    048     */
    049    void onEvent(T event);
    050}