Passing one object to many classes using Java

I need to pass an object from one class to many different classes.

The purpose of this is to create one method that passes an object to other listeners. This means that you can add more classes, and I just need to implement the listener function for this class, and not edit any framework.

I am trying to accomplish this without using JMS (if possible!)

+3
source share
1 answer

Sample observer for help! Woooosh!

Let your subject determine the relay method of this object for many observers. Then you can dynamically add and remove listeners.

+10
source

Source: https://habr.com/ru/post/1787750/


All Articles