Class LambdaListener

  • All Implemented Interfaces:
    IListener

    public class LambdaListener
    extends java.lang.Object
    implements IListener
    Default implementation of a IListener that creates a lambda at runtime to call the target method.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  LambdaListener.Factory  
    • Constructor Summary

      Constructors 
      Constructor Description
      LambdaListener​(LambdaListener.Factory factory, java.lang.Class<?> klass, java.lang.Object object, java.lang.reflect.Method method)
      Creates a new lambda listener, can be used for both static and non-static methods.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void call​(java.lang.Object event)
      Calls the listener with the specified event.
      int getPriority()  
      java.lang.Class<?> getTarget()  
      boolean isStatic()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LambdaListener

        public LambdaListener​(LambdaListener.Factory factory,
                              java.lang.Class<?> klass,
                              java.lang.Object object,
                              java.lang.reflect.Method method)
        Creates a new lambda listener, can be used for both static and non-static methods.
        Parameters:
        klass - Class of the object
        object - Object, null if static
        method - Method to create lambda for
    • Method Detail

      • call

        public void call​(java.lang.Object event)
        Description copied from interface: IListener
        Calls the listener with the specified event.
        Specified by:
        call in interface IListener
        Parameters:
        event - Event to pass in
      • getTarget

        public java.lang.Class<?> getTarget()
        Specified by:
        getTarget in interface IListener
        Returns:
        The target event type this listener is for
      • getPriority

        public int getPriority()
        Specified by:
        getPriority in interface IListener
        Returns:
        The priority for this listener
      • isStatic

        public boolean isStatic()
        Specified by:
        isStatic in interface IListener
        Returns:
        True if this listener is for static methods