An instance of reading peroperties file based on JavaBean editor
introduction
Recently, I reread the book "proficient in Spring + 4. X + + enterprise application development practice", saw the part about JavaBean editor, and learned about the use of propertyeditor and beaninfo. It has to be said that beaninfo is a very powerful thing, and the introspection in Java is also a little related to it.
JavaBean, propertyeditor and beaninfo
JavaBean introduction
JavaBean is a reusable component written in Java. In essence, it is a Java class. However, different from general Java classes, JavaBean must have a parameterless constructor, its fields must be privatized, and provide set and get methods for external use. According to the book, the JavaBean specification developed by sun is largely prepared for the IDE -- it allows the IDE to set JavaBean properties in a visual way.
Propertyeditor interface
Propertyeditor is the interface of the property editor. Its function is to convert a string type value into a JavaBean property. Java provides a default implementation class propertyeditorsupport for propertyeditor.
Beaninfo interface
Beaninfo is used to describe which properties of a JavaBean can be edited and the corresponding property editor. Java also provides a default implementation for beaninfo -- simplebeaninfo.
other
For more information about JavaBeans and these two interfaces, you can buy this book "Mastering the actual combat of Spring + 4. X + + enterprise application development", or read my copy