diff options
author | Leif Åstrand <leif@vaadin.com> | 2016-11-23 09:52:07 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2016-11-23 09:52:07 +0200 |
commit | 68ea8ea63d9ba04f166f0a5897516c586c696e50 (patch) | |
tree | 31c99d3ee27d810e80e6365c32c47a0525b38918 /server/src/main/java/com/vaadin/event/MethodEventSource.java | |
parent | b9a107c2f7a8227c12a6df6a29c9abaf292863c9 (diff) | |
download | vaadin-framework-68ea8ea63d9ba04f166f0a5897516c586c696e50.tar.gz vaadin-framework-68ea8ea63d9ba04f166f0a5897516c586c696e50.zip |
Refactor listener registration creation to reduce boilerplate
Change-Id: I9feaad000cb16351d281d1c0037330dfb76186ff
Diffstat (limited to 'server/src/main/java/com/vaadin/event/MethodEventSource.java')
-rw-r--r-- | server/src/main/java/com/vaadin/event/MethodEventSource.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/server/src/main/java/com/vaadin/event/MethodEventSource.java b/server/src/main/java/com/vaadin/event/MethodEventSource.java index 42f4902122..2ba5586eb1 100644 --- a/server/src/main/java/com/vaadin/event/MethodEventSource.java +++ b/server/src/main/java/com/vaadin/event/MethodEventSource.java @@ -19,6 +19,8 @@ package com.vaadin.event; import java.io.Serializable; import java.lang.reflect.Method; +import com.vaadin.shared.Registration; + /** * <p> * Interface for classes supporting registration of methods as event receivers. @@ -54,13 +56,15 @@ public interface MethodEventSource extends Serializable { * the object instance who owns the activation method. * @param method * the activation method. + * @return a registration object for removing the listener * @throws java.lang.IllegalArgumentException * unless <code>method</code> has exactly one match in * <code>object</code> * @throws NullPointerException * if {@code object} is {@code null} */ - public void addListener(Class<?> eventType, Object object, Method method); + public Registration addListener(Class<?> eventType, Object object, + Method method); /** * <p> @@ -89,13 +93,14 @@ public interface MethodEventSource extends Serializable { * 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 java.lang.IllegalArgumentException * unless <code>method</code> has exactly one match in * <code>object</code> * @throws NullPointerException * if {@code object} is {@code null} */ - public void addListener(Class<?> eventType, Object object, + public Registration addListener(Class<?> eventType, Object object, String methodName); /** |