Class BusMatcherSugar



  • public class BusMatcherSugar
    extends java.lang.Object
    Declarative syntactic sugar which may be statically imported in order to allow declarative definitions for the BusMatcher elements.
    • Constructor Summary

      Constructors 
      Constructor Description
      BusMatcherSugar​()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E extends BusEvent,A>
      BusMatcher
      actionEqualWith​(A aAction)
      Factory method to create an "EQUAL WITH" matcher for the given action compared with the action stored in the EventMetaData.
      static BusMatcher aliasEqualWith​(java.lang.String aAlias)
      Factory method to create an "EQUAL WITH" matcher for the given name compared with the name stored in the EventMetaData.
      static BusMatcher and​(BusMatcher... aEventMatchers)
      Factory method to create an "AND" matcher for the given matchers.
      static BusMatcher catchAll​()
      Catches all events, no matching is done.
      static BusMatcher catchNone​()
      Catches no event, no matching is done.
      static BusMatcher channelEqualWith​(java.lang.String aChannel)
      Factory method to create an "EQUAL WITH" matcher for the given channel compared with the channel stored in the EventMetaData.
      static BusMatcher groupEqualWith​(java.lang.String aGroup)
      Factory method to create an "EQUAL WITH" matcher for the given group compared with the group stored in the EventMetaData.
      static BusMatcher isAssignableFrom​(java.lang.Class<?> aEventType)
      Factory method to create an event matcher by event type.
      static BusMatcher or​(BusMatcher... aEventMatchers)
      Factory method to create an "OR" matcher for the given matchers.
      static <E extends BusEvent,PT>
      BusMatcher
      publisherIsAssignableFrom​(java.lang.Class<? extends PT> aPublisherType)
      Factory method to create an event matcher by event publisher type.
      static BusMatcher uidIdEqualWith​(java.lang.String aUid)
      Factory method to create an "EQUAL WITH" matcher for the given UID compared with the UID stored in the EventMetaData.
      • Methods inherited from class java.lang.Object

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

      • BusMatcherSugar

        public BusMatcherSugar​()
    • Method Detail

      • catchAll

        public static BusMatcher catchAll​()
        Catches all events, no matching is done.
        Returns:
        The "catch-all" BusMatcher.
      • catchNone

        public static BusMatcher catchNone​()
        Catches no event, no matching is done.
        Returns:
        The "catch-none" BusMatcher.
      • isAssignableFrom

        public static BusMatcher isAssignableFrom​(java.lang.Class<?> aEventType)
        Factory method to create an event matcher by event type.
        Parameters:
        aEventType - The event type to be matched by this matcher.
        Returns:
        An event matcher by event type.
      • publisherIsAssignableFrom

        public static <E extends BusEvent,PT> BusMatcher publisherIsAssignableFrom​(java.lang.Class<? extends PT> aPublisherType)
        Factory method to create an event matcher by event publisher type.
        Type Parameters:
        E - the element type
        PT - The publisher descriptor type
        Parameters:
        aPublisherType - The event publisher type to be matched by this matcher.
        Returns:
        An event matcher by event type.
      • or

        @SafeVarargs
        public static BusMatcher or​(BusMatcher... aEventMatchers)
        Factory method to create an "OR" matcher for the given matchers.
        Parameters:
        aEventMatchers - The matchers to be combined by an "OR".
        Returns:
        An "OR" matcher.
      • and

        @SafeVarargs
        public static BusMatcher and​(BusMatcher... aEventMatchers)
        Factory method to create an "AND" matcher for the given matchers.
        Parameters:
        aEventMatchers - The matchers to be combined by an "AND".
        Returns:
        An "AND" matcher.
      • aliasEqualWith

        public static BusMatcher aliasEqualWith​(java.lang.String aAlias)
        Factory method to create an "EQUAL WITH" matcher for the given name compared with the name stored in the EventMetaData.
        Parameters:
        aAlias - The name to be compared with a GenericMetaDataEvent's EventMetaData's name property.
        Returns:
        An "EQUAL WITH" matcher regarding the GenericMetaDataEvent's name property.
      • groupEqualWith

        public static BusMatcher groupEqualWith​(java.lang.String aGroup)
        Factory method to create an "EQUAL WITH" matcher for the given group compared with the group stored in the EventMetaData.
        Parameters:
        aGroup - The group to be compared with a GenericMetaDataEvent's EventMetaData's group property.
        Returns:
        An "EQUAL WITH" matcher regarding the GenericMetaDataEvent's group property.
      • channelEqualWith

        public static BusMatcher channelEqualWith​(java.lang.String aChannel)
        Factory method to create an "EQUAL WITH" matcher for the given channel compared with the channel stored in the EventMetaData.
        Parameters:
        aChannel - The channel to be compared with a GenericMetaDataEvent's EventMetaData's channel property.
        Returns:
        An "EQUAL WITH" matcher regarding the GenericMetaDataEvent's channel property.
      • uidIdEqualWith

        public static BusMatcher uidIdEqualWith​(java.lang.String aUid)
        Factory method to create an "EQUAL WITH" matcher for the given UID compared with the UID stored in the EventMetaData.
        Parameters:
        aUid - The UID to be compared with a GenericMetaDataEvent's EventMetaData's UID property.
        Returns:
        An "EQUAL WITH" matcher regarding the GenericMetaDataEvent's UID property.
      • actionEqualWith

        public static <E extends BusEvent,A> BusMatcher actionEqualWith​(A aAction)
        Factory method to create an "EQUAL WITH" matcher for the given action compared with the action stored in the EventMetaData.
        Type Parameters:
        E - the element type
        A - The type of the action stored in the event. CAUTION: The drawback of not using generic generic type declaration on a class level is no granted type safety, the advantage is the ease of use: Sub-classes can be used out of the box.
        Parameters:
        aAction - The action to be compared with a GenericMetaDataEvent's EventMetaData's action property.
        Returns:
        An "EQUAL WITH" matcher regarding the GenericActionEvent's action property.