Interface Broadcaster

All Superinterfaces:
NamedObject, Transceiver, Transmitter<Transmittable>
All Known Subinterfaces:
Component, ComponentMixin, Converter<From,​To>, Extractor<Value,​From>, FileService, NetworkResource, Repeater, RepeaterMixin, Resource, SerializationSession, StringConverter<Value>, TwoWayConverter<From,​To>, WritableResource
All Known Implementing Classes:
Application, AttachmentConverter, AttachmentListConverter, BaseCollectionChangeWatcher, BaseCollectionConverter, BaseComponent, BaseConverter, BaseExtractor, BaseFormattedConverter, BaseFormattedLocalTimeConverter, BaseHttpResource, BaseListConverter, BaseNetworkResource, BaseReadableResource, BaseRepeater, BaseSetConverter, BaseStringConverter, BaseWritableResource, Batcher, BatcherTest, BatcherTest.TestBatcher, BodyConverter, BooleanConverter, Bytes.Converter, ClassConverter, ConcurrentProgress, Confidence.Converter, ConnectionListener, CoreApplicationProject, CoreCollectionsProject, CoreCommandLineProject, CoreConfigurationProject, CoreNetworkEmailProject, CoreNetworkFtpProject, CoreNetworkHttpProject, CoreNetworkSocketProject, CoreSecurityProject, CoreTestProject, Count.Converter, DateTimeConverter, Deployment, Deployment.Converter, DeploymentSet, DoubleConverter, Duration.Converter, Duration.MillisecondsConverter, Duration.SecondsConverter, EmailAddress.Converter, EmailAddressConverter, EmailAddressSetConverter, EmailSender, EnumConverter, EnumListConverter, EnumSetConverter, FieldArchive, File, File.Converter, FileCache, FileList.Converter, FilePath.Converter, FloatConverter, Folder, Folder.Converter, FolderChangeWatcher, FolderList.Converter, FormattedDoubleConverter, FormattedIntegerConverter, FormattedLongConverter, Frequency.Converter, FtpResource, HexadecimalLongConverter, Host.Converter, HttpDateTimeConverter, HttpGetResource, HttpNetworkLocation.Converter, HttpPostResource, HttpPutResource, HumanizedLocalDateTimeConverter, Identifier.Converter, IdentityConverter, InputResource, IntegerConverter, IntegerIdentifier.Converter, IsoLocalDateTimeConverter, JarLauncher, KernelProject, KivaKit, KivaKitThread, KryoSerializationSession, LanguageIsoCode.Converter, Level.Converter, LineReader, LocalDateConverter, LocalDateTimeConverter, LocalDateTimeWithMillisecondsConverter, LocalDateTimeWithSecondsConverter, LocalTimeConverter, LongConverter, Maximum.Converter, MessageChecker, Minimum.Converter, Multicaster, NetworkCoreProject, NetworkLocation.Converter, NetworkPath.Converter, NullResource, OutputResource, PackageResource, PatternConverter, Percent.Converter, PeriodicCollectionChangeWatcher, PlainTextPassword.Converter, Port.Converter, Port.ListConverter, Progress, Project, Quantizable.Converter, RepeatingKivaKitThread, Resource.Converter, ResourceFolder.Converter, ResourceList.Converter, ResourcePath.Converter, ResourceProject, ResourceSection, Retry, SecureFtpResource, SecureHttpGetResource, SecureHttpPostResource, SerializationCoreProject, SerializationJerseyJsonProject, SerializationJsonProject, SerializationKryoProject, Server, Settings, SettingsFolder, SettingsPackage, SftpFolderWatcher, SmtpEmailSender, StateMachine, StringList.Converter, StringResource, ThrowableConverter, UserName.Converter, UtcDateTimeConverter, VersionConverter, VirtualReferenceTracker, ZipEntry, ZoneIdConverter

public interface Broadcaster extends Transceiver, Transmitter<Transmittable>
Broadcasts a message to zero or more listeners via transmit(Transmittable). Listeners can be added with addListener(Listener) and can be cleared with clearListeners(). A number of convenience methods in the Transceiver superclass make it easier to broadcast specific messages.

Convenience Methods

A number of convenience methods in the Transceiver superinterface make it easy to transmit specific common messages. Repeaters are Broadcasters (as well as Listeners) which inherit the methods in this class as well as those in Transceiver. For details on how to take advantage of this in object design, see Repeater.

Author:
jonathanl (shibo)
See Also:
Transceiver, Broadcaster, Repeater, Listener, Message, State(Art) Blog Article
  • Method Details

    • addListener

      void addListener(Listener listener, Filter<Transmittable> filter)
      Adds a listener to this broadcaster that wants to receive future messages. This is the mirror method of Listener.listenTo(Broadcaster) as both methods achieve the same thing.
      Parameters:
      listener - Listener to broadcast to. Implementations should ignore null listeners.
    • addListener

      default void addListener(Listener listener)
      Adds a listener to this broadcaster that wants to receive future messages.
    • clearListeners

      void clearListeners()
      Removes all listeners from this broadcaster
    • hasListeners

      boolean hasListeners()
      Returns:
      True if this broadcaster has any listeners
    • messageSource

      Broadcaster messageSource()
      Not public API
    • messageSource

      void messageSource(Broadcaster parent)
      Not public API
    • onHandle

      default void onHandle(Transmittable message)
      A broadcaster handles a message by transmitting it
      Specified by:
      onHandle in interface Transceiver
    • onTransmit

      default void onTransmit(Transmittable message)
      Not public API

      Allows subclass to transmit message to listeners

    • removeListener

      void removeListener(Listener listener)
      Removes the given listener from this broadcaster
    • silence

      default void silence()
      Causes this broadcaster to broadcast only to the null listener
    • transmit

      default void transmit(Transmittable message)
      Not public API

      Transmits the given message by calling the subclass

      Specified by:
      transmit in interface Transmitter<Transmittable>
    • transmit

      default void transmit(Message message)
    • transmitAll

      default void transmitAll(Iterable<Transmittable> messages)
      Broadcasts the given messages to any listeners in the audience of this broadcaster
      Parameters:
      messages - The messages to broadcast