Can I add listeners/publisher subscriber to JAXB objects?
I have a multithreaded application using JAXB. The JAXB object represent state of other system hardware. I have a thread monitoring the system h开发者_StackOverflow社区ardware, and it updates the JAXB objects with the setters to update the state.
I have another chunk of code that is supposed to "do something" when the state of an object changes. I'm wondering how to set up event listeners, or some sort of publisher subscriber scheme, so that when a JAXB object changes state, the appropriate response to the change is kicked off. I have not seen anything describing how something could register as a listener with a JAXB object.
JAXB objects are just POJOs, so you can modify the code to add listeners appropriate to your use case.
精彩评论