6 ms·
Correct. The parameter of those methods use(d) a class from the Swing desktop UI toolkit, and logging can't depend on that. Parameter class in question: http:/
by Ironlink 9y ago
Correct. The parameter of those methods use(d) a class from the Swing desktop UI toolkit, and logging can't depend on that.
Parameter class in question: http://download.java.net/java/jdk9/docs/api/java/beans/PropertyChangeListener.html http://download.java.net/java/jdk9/docs/api/java/beans/Prope...
- vbezhenar 9y agoWhy java.beans.PropertyChangeListener is from Swing UI? Looks like part of Java Bean standard which is supposed to be just high-level reflection API. System thing, nothing wrong to depend on it.
- jdmichal 9y agoFrom the JavaDocs for PropertyChangeListener [0]: > A "PropertyChange" event gets fired whenever a bean changes a "bound" property. You can register a PropertyChangeListener with a source bean so as to be notified of any bound property updates. I believe the idea of a "bound" property is a Swing UI concept. That is, it implements a binding from the bean to a UI element. If you look at the implementing class list, it's all Swing UI components that implement it. [0] http://download.java.net/java/jdk9/docs/api/java/beans/PropertyChangeListener.html http://download.java.net/java/jdk9/docs/api/java/beans/Prope...
- needusername 9y ago> Why java.beans.PropertyChangeListener is from Swing UI? Well the java.beans package and Swing UI are in the same module. Why? Because java.beans depends on AWT. Why? Because of interfaces like this https://docs.oracle.com/javase/8/docs/api/java/beans/BeanInfo.html https://docs.oracle.com/javase/8/docs/api/java/beans/BeanInf... Could AWT und Swing still be split into different modules? Maybe. Does that mean that almost every Java application will have to deploy two UI toolkits, PLaFs and sound even if it's just a web service? Yes because almost every Java application at least indirectly depends on java.beans. Does Oracle or Java 9 / Jigsaw marketing care? No.
- lmm 9y agoWhat's the use case for java.beans in a non-GUI application? Why do you say almost every Java application depends on it?
- needusername 9y ago> What's the use case for java.beans in a non-GUI application? Mostly simplified calling of getters and setters, i.e. emulation of object properties. > Why do you say almost every Java application depends on it? - JAXB (XML binding) and Activation depend on it, so if you have direct or indirect dependency on JAXB or Activation you need java.beans. - Spring depends on java.beans
- vbezhenar 9y agoIt's hard to imagine an application without getters and setters. Now if you want to read/write those beans in a generic way, you need to use reflection. And correct approach is to use java.beans classes instead of rolling your own low-level solution.