Interface ListenerManager<T>

  • Type Parameters:
    T - The listener class.


    public interface ListenerManager<T>
    This class can be used to edit added listeners afterwards.
    • Method Detail

      • isGlobalListener

        boolean isGlobalListener​()
        Checks if the managed listener is a global listener.
        Returns:
        Whether the managed listener is a global listener or not.
      • getListenerClass

        Class<T> getListenerClass​()
        Gets the listener class context for the managed listener.
        Returns:
        The listener class context for the managed listener.
      • getListener

        T getListener​()
        Gets the managed listener.
        Returns:
        The managed listener.
      • getAssignedObjectClass

        Optional<Class<?>> getAssignedObjectClass​()
        Gets the class of the object, the listener was added to. For global listeners, it returns an empty Optional.
        Returns:
        The class of the object, the listener was added to.
      • getAssignedObjectId

        Optional<Long> getAssignedObjectId​()
        Gets the id of the object, the listener as added to. Empty for global listeners.
        Returns:
        The id of the object, the listener was added to.
      • remove

        ListenerManager<T> remove​()
        Removes the listener.
        Returns:
        The current instance in order to chain call methods.
      • removeAfter

        ListenerManager<T> removeAfter​(long delay,
                                       TimeUnit timeUnit)
        Removes the listener after the given delay.
        Parameters:
        delay - The time to wait before removing the listener.
        timeUnit - The time unit of the delay.
        Returns:
        The current instance in order to chain call methods.
      • addRemoveHandler

        void addRemoveHandler​(Runnable removeHandler)
        Adds a runnable which gets called when the listener gets removed.
        Parameters:
        removeHandler - The handler which gets called when the listener gets remove.