Customizers
A customizer is a user interface for customizing an entire Bean, as opposed to a single property. The characteristics and behaviors of the Bean that can be modified by a customizer are not limited to its exposed properties. There can be any number of other settings that are needed to configure a Bean that are not considered properties.
The complexity of the configuration options for a Bean is another possible reason to provide a customizer. This gives you an opportunity to present these choices in a way that makes more sense to a user, and might even provide a mechanism which can guide the user through the process.
If you provide a customizer, you must also provide a BeanInfo class
for your Bean in order to identify its associated customizer class.
There is no standard naming convention that can be followed, nor is
there any kind of customizer manager class provided by the JDK. This
is another area that seems inconsistent. I don’t see any reason
why a run-time registration mechanism, like that provided by the
java.beans.PropertyEditorManager
, could not have
been provided for registering Bean customizers at run-time. Likewise,
I think a naming convention that appends the string
Customizer
to the Bean class name would have been
useful, allowing for the creation of customizers without the need for
creating a BeanInfo class. However, it is almost trivial to create a
BeanInfo class solely for the purpose of specifying an associated
customizer class.
Although customizers are ...
Get Developing Java Beans now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.