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

com.vaadin.event.MethodEventSource Maven / Gradle / Ivy

There is a newer version: 8.27.3
Show newest version
/*
 * Copyright (C) 2000-2024 Vaadin Ltd
 *
 * This program is available under Vaadin Commercial License and Service Terms.
 *
 * See  for the full
 * license.
 */

package com.vaadin.event;

import java.io.Serializable;
import java.lang.reflect.Method;

import com.vaadin.shared.Registration;

/**
 * 

* Interface for classes supporting registration of methods as event receivers. *

* *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @author Vaadin Ltd. * @since 3.0 */ public interface MethodEventSource extends Serializable { /** * Registers a new event listener with the specified activation method to * listen events generated by this component. If the activation method does * not have any arguments the event object will not be passed to it when * it's called. * *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the type of the listened event. Events of this type or its * subclasses activate the listener. * @param object * the object instance who owns the activation method. * @param method * the activation method. * @return a registration object for removing the listener * @throws IllegalArgumentException * unless method has exactly one match in * object * @throws NullPointerException * if {@code object} is {@code null} * @since 8.0 */ @Deprecated public Registration addListener(Class eventType, Object object, Method method); /** * Registers a new event listener with the specified activation method to * listen events generated by this component. If the activation method does * not have any arguments the event object will not be passed to it when * it's called. * *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the type of the listened event. Events of this type or its * subclasses activate the listener. * @param listener * the listener instance who owns the activation method. * @param method * the activation method. * @return a registration object for removing the listener * @throws IllegalArgumentException * unless method has exactly one match in * object * @throws NullPointerException * if {@code object} is {@code null} * @since 8.12 */ public Registration addListener(Class eventType, SerializableEventListener listener, Method method); /** * Registers a new listener with the specified activation method to listen * events generated by this component. If the activation method does not * have any arguments the event object will not be passed to it when it's * called. * *

* This version of addListener gets the name of the activation * method as a parameter. The actual method is reflected from * object, and unless exactly one match is found, * java.lang.IllegalArgumentException is thrown. *

* *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the type of the listened event. Events of this type or its * subclasses activate the listener. * @param object * the object instance who owns the activation method. * @param methodName * the name of the activation method. * @return a registration object for removing the listener * @throws IllegalArgumentException * unless method has exactly one match in * object * @throws NullPointerException * if {@code object} is {@code null} * @since 8.0 */ @Deprecated public Registration addListener(Class eventType, Object object, String methodName); /** * Registers a new listener with the specified activation method to listen * events generated by this component. If the activation method does not * have any arguments the event object will not be passed to it when it's * called. * *

* This version of addListener gets the name of the activation * method as a parameter. The actual method is reflected from * listener, and unless exactly one match is found, * java.lang.IllegalArgumentException is thrown. *

* *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the type of the listened event. Events of this type or its * subclasses activate the listener. * @param listener * the listener instance who owns the activation method. * @param methodName * the name of the activation method. * @return a registration object for removing the listener * @throws IllegalArgumentException * unless method has exactly one match in * object * @throws NullPointerException * if {@code object} is {@code null} * @since 8.12 */ public Registration addListener(Class eventType, SerializableEventListener listener, String methodName); /** * Removes all registered listeners matching the given parameters. Since * this method receives the event type and the listener object as * parameters, it will unregister all object's methods that are * registered to listen to events of type eventType generated * by this component. * *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the exact event type the object listens to. * @param target * the target object that has registered to listen to events of * type eventType with one or more methods. */ @Deprecated public void removeListener(Class eventType, Object target); /** * Removes all registered listeners matching the given parameters. Since * this method receives the event type and the listener object as * parameters, it will unregister all object's methods that are * registered to listen to events of type eventType generated * by this component. * *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the exact event type the object listens to. * @param listener * the listener that has registered to listen to events of type * eventType with one or more methods. * @since 8.12 */ public void removeListener(Class eventType, SerializableEventListener listener); /** * Removes one registered listener method. The given method owned by the * given object will no longer be called when the specified events are * generated by this component. * *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the exact event type the object listens to. * @param target * the target object that has registered to listen to events of * type eventType with one or more methods. * @param method * the method owned by the target that's registered to listen to * events of type eventType. * @deprecated use a {@link Registration} returned by * {@link #addListener(Class, Object, Method)} */ @Deprecated public void removeListener(Class eventType, Object target, Method method); /** * Removes one registered listener method. The given method owned by the * given object will no longer be called when the specified events are * generated by this component. * *

* This version of removeListener gets the name of the * activation method as a parameter. The actual method is reflected from the * target, and unless exactly one match is found, * java.lang.IllegalArgumentException is thrown. *

* *

* For more information on the inheritable event mechanism see the * {@link com.vaadin.event com.vaadin.event package documentation}. *

* * @param eventType * the exact event type the object listens to. * @param target * the target object that has registered to listen to events of * type eventType with one or more methods. * @param methodName * the name of the method owned by target that's * registered to listen to events of type eventType. * @deprecated use a {@link Registration} returned by * {@link #addListener(Class, Object, String)} */ @Deprecated public void removeListener(Class eventType, Object target, String methodName); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy