All Known Implementing Classes:
ClassEventInheritancePolicy, CompleteEventInheritancePolicy, InterfaceEventInheritancePolicy, NoEventInheritancePolicy

public interface InheritancePolicy
The interface that defines an inheritance policy to apply on the event class. An inheritance policy is an internal algorithm of the EventBus which change is behaviour relating to the management of events notifications. For example in the ClassEventInheritancePolicy when a new event is posted in the bus, it is notified to all the listeners which listen to the specific event, and also to all the listeners which listen to events which extends the first event. Take a look to each policy to a better understanding of the details.
See Also:
  • Method Details

    • getAllEventInheritanceObjects

      Set<Class<?>> getAllEventInheritanceObjects(Object eventObjectToPost, EventsRegistrationsMap eventsRegistrations, Map<Class<?>,Set<Class<?>>> eventSuperClassesAndInterfacesCache)
      The interface method that returns a set of classes (the implementation uses LinkedHashSet to preserve order of insertion), based on the chosen inheritance policy.
      Parameters:
      eventObjectToPost - The event object to post.
      eventsRegistrations - The complete map of events' Registrations.
      eventSuperClassesAndInterfacesCache - The cache used to save event class/superclasses/interfaces serialization.
      Returns:
      a set of classes based on the chosen inheritance policy.
    • serializeInterfaces

      default void serializeInterfaces(Set<Class<?>> eventClassesAndInterfaces, EventsRegistrationsMap eventsRegistrations, Class<?> clazz)
      Method that finds all interfaces given the starting class to serialize and adds them to the given parameter set (eventClassesAndInterfaces).
      Parameters:
      eventClassesAndInterfaces - The set to populate.
      eventsRegistrations - The event registration map.
      clazz - The class to serialize (we want to find all interfaces)
    • addClassOrInterfaceToSerializationIfNecessary

      default void addClassOrInterfaceToSerializationIfNecessary(Set<Class<?>> eventClassesAndInterfaces, EventsRegistrationsMap eventsRegistrations, Class<?> clazz)
      Method that adds a class to the (eventClassesAndInterfaces) set if the class is not already contained in the (eventsRegistrations) map.
      Parameters:
      eventClassesAndInterfaces - The set to populate.
      eventsRegistrations - The event registration map.
      clazz - The class to add to the set.