BeanInfo annotations [JEP-256]
The JEP-256 focused on replacing @beanifo
javadoc tags with more appropriate annotations. Furthermore, these new annotations are now processed at runtime so that BeanInfo
classes can be generated dynamically. The modularity of Java 9 resulted in this change. The creation of custom BeanInfo
classes has been simplified and the client library has been modularized.
In order to fully grasp this change, we will review JavaBean
, BeanProperty
, and SwingContainer
before going any further into this JEP.
JavaBean
A JavaBean
is a Java class. Like other Java classes, JavaBeans
are reusable code. They are unique in their design because they encapsulate several objects into one. There are three conventions a JavaBean
class must follow:
- The constructor should not take any arguments
- It must be serializable
- It must contain mutator and accessor methods for its properties
Here is an example JavaBean
class:
publicclassMyBeanimplements java.io.Serializable { // instance variables...