1N/A Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved. 1N/A DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1N/A This code is free software; you can redistribute it and/or modify it 1N/A under the terms of the GNU General Public License version 2 only, as 1N/A published by the Free Software Foundation. Sun designates this 1N/A particular file as subject to the "Classpath" exception as provided 1N/A by Sun in the LICENSE file that accompanied this code. 1N/A This code is distributed in the hope that it will be useful, but WITHOUT 1N/A ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1N/A FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1N/A version 2 for more details (a copy is included in the LICENSE file that 1N/A accompanied this code). 1N/A You should have received a copy of the GNU General Public License version 1N/A 2 along with this work; if not, write to the Free Software Foundation, 1N/A Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1N/A Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1N/A CA 95054 USA or visit www.sun.com if you need additional information or 1N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1N/A<
body bgcolor="white">
1N/AContains classes related to developing
1N/A<
em>beans</
em> -- components
1N/Abased on the JavaBeans<
sup><
font size=-
2>TM</
font></
sup> architecture.
1N/Aclasses are used by beans while they run in an application.
1N/AFor example, the event classes are
1N/Aused by beans that fire property and vetoable change
1N/Apackage are meant to be used by a bean editor (that is, a development environment
1N/Afor customizing and putting together beans to create an application). In
1N/Aparticular, these classes help the bean editor create a user
1N/Ainterface that the user can use to customize the bean. For example, a bean may
1N/Acontain a property of a special type that a bean editor may not know how to handle.
1N/ABy using the <
code>PropertyEditor</
code> interface, a bean developer can
1N/Aprovide an editor for this special type.
1N/ATo minimize the resources used by a bean, the classes used by bean editors are loaded only
1N/Awhen the bean is being edited. They are not needed while the bean is running in an application
1N/Aand therefore not loaded. This information is kept in what's called a bean-info (see {@link
java.
beans.
BeanInfo}).
1N/AUnless explicitly stated, null values or empty Strings are not valid
1N/Aparameters for the methods in this package. You may expect to see
1N/Aexceptions if these parameters are used.
1N/A<
h2>Long-Term Persistence</
h2>
1N/A<
em>long-term persistence</
em> -- reading and
1N/Awriting a bean as a textual representation of its property values.
1N/AThe property values are treated as beans,
1N/Aand are recursively read or written to capture
1N/Atheir publicly available state.
1N/AThis approach is suitable for long-term storage
1N/Abecause it relies only on public API,
1N/Arather than the likely-to-change private implementation.
1N/AThe persistence scheme cannot automatically instantiate
1N/Acustom inner classes, such as you might use for event handlers.
1N/Ainstead of inner classes for custom event handlers,
1N/Ayou can avoid this problem.
1N/AYou read and write beans in XML format using the
1N/Aclasses, respectively.
1N/AOne notable feature of the persistence scheme is that
1N/Areading in a bean requires no special knowledge of the bean.
1N/AWriting out a bean, on the other hand,
1N/Asometimes requires special knowledge of the bean's type.
1N/AIf the bean's state can be
1N/Aexpressed using only the no-argument constructor and
1N/Apublic getter and setter methods for properties,
1N/Ano special knowledge is required.
1N/AOtherwise, the bean requires a custom <
em>persistence delegate</
em> --
1N/Aan object that is in charge of writing out beans of a particular type.
1N/AAll classes provided in the JDK that descend
1N/Aas well as all their properties,
1N/Aautomatically have persistence delegates.
1N/AIf you need (or choose) to provide a persistence delegate for a bean,
1N/Ayou can do so either by using a
1N/Aor by creating your own subclass of <
code>PersistenceDelegate</
code>.
1N/AIf the only reason a bean needs a persistence delegate
1N/Ais because you want to invoke the bean's constructor with
1N/Aproperty values as arguments,
1N/Ayou can create the bean's persistence delegate
1N/Awith the one-argument
1N/A<
code>DefaultPersistenceDelegate</
code>
1N/Ayou need to implement your own persistence delegate,
1N/Afor which you're likely to need the following classes:
1N/A<
dd> The abstract class from which all persistence delegates descend.
1N/A Your subclass should use its knowledge of the bean's type to provide
1N/A whatever <
code>Statement</
code>s and <
code>Expression</
code>s
are necessary to create the bean
<
dd> Represents the invocation of a single method on an object.
Includes a set of arguments to the method.
<
dd> A subclass of <
code>Statement</
code>
used for methods that return a value.
Once you create a persistence delegate,
you register it using the
<
code>setPersistenceDelegate</
code> method of
<
h2>Related Documentation</
h2>
For overview, architecture, and tutorial documentation, please see: