Example of non-gui use of customized/editted bean?
Is there an example anywhere of how a non-gui class would use a bean that has been customized by a customizer or edited by a property editor?
The javabeans tutorial describes property editors and customizers, but not how the resulting bean would be created and used, as far as I can tell.
[301 byte] By [
queshawa] at [2007-11-26 21:56:59]

# 1
More generally, a bean is meant to be a component that can be customized at design time and then that customized component can be used at runtime, correct?
A builder tool allows an application designer to persistently set some properties on the bean, so that when the bean is activated at runtime, the properties will have the values they were set to at design time, correct?
How specifically does the resulting customized bean, having been customized in a builder tool, with properties changed, get used by the client of the bean? What code would be needed to activate the bean with it's customized properties?
# 2
Tutorial about property editors:
http://java.sun.com/docs/books/tutorial/javabeans/introspection/index.html
Small tutorial about customizers:
http://java.sun.com/docs/books/tutorial/javabeans/customization/index.html
Do you have any ideas what we should add in the tutorial?
# 3
> More generally, a bean is meant to be a component
> that can be customized at design time and then that
> customized component can be used at runtime
Correct.
> A builder tool allows an application designer to
> persistently set some properties on the bean, so that
> when the bean is activated at runtime, the properties
> will have the values they were set to at design time.
It depends on builder tool.
> How specifically does the resulting customized bean,
> having been customized in a builder tool, with
> properties changed, get used by the client of the
> bean? What code would be needed to activate the bean
> with it's customized properties?
Look at BeanBuilder, for example:
https://bean-builder.dev.java.net/
It generates UI, then encodes it into XML using XMLEncoder:
http://java.sun.com/products/jfc/tsc/articles/persistence4
Application can read it from XML archive using XMLDecoder:
http://java.sun.com/products/jfc/tsc/articles/persistence3
Is it helpful?
# 4
Thanks. The two persistence links look very helpful. Though I gather this is still not directly an answer to what I need to do to instantiate a bean. Invoking encode or decode is what a builder tool would use and what java.beans.Beans.instantiate() would use, not actually what a person would use directly to instantiate a bean. I think I'm supposed to instantiate a bean using Beans.instantiate().
The bean builder unfortunately seems to have this bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5066212
which prevents me from doing the bean builder tutorial as it is written.
For the JavaBeans tutorial, I think it would be good to add how to instantiate a customized bean in an application. The tutorial describes how to write a customizer or a property editor, but not how to then use the resulting bean at run time.
It would also be good to describe how a customized bean is physically packaged. If someone gives me a bean and I customize it using a builder tool, what physical form does it take in terms of files? If I send someone a bean in a jar file and they customize it using a builder tool, does the tool modify my jar file to put a serialized object in it? It it doesn't modify the jar file, what file is created and how do they then include this with their application?
Message was edited by:
queshaw