DefaultPersistenceDelegate is a concrete implementation of
the abstract PersistenceDelegate class and
is the delegate used by default for classes about
which no information is available. The DefaultPersistenceDelegate
provides, version resilient, public API-based persistence for
classes that follow the JavaBeans conventions without any class specific
configuration.
The key assumptions are that the class has a nullary constructor
and that its state is accurately represented by matching pairs
of "setter" and "getter" methods in the order they are returned
by the Introspector.
In addition to providing code-free persistence for JavaBeans,
the DefaultPersistenceDelegate provides a convenient means
to effect persistent storage for classes that have a constructor
that, while not nullary, simply requires some property values
as arguments.
DefaultPersistenceDelegate(String[]), java.beans.Introspector
| Modifier and Type | Field and Description |
|---|---|
| private final String[] | |
| private Boolean | |
| private static final String[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | DefaultPersistenceDelegate(String[]
The property names for the arguments of this constructor. constructorPropertyNames)Creates a default persistence delegate for a class with a
constructor whose arguments are the values of the property
names as specified by |
| Modifier and Type | Method and Description |
|---|---|
| private static boolean | |
| private boolean | |
| private void | doProperty(Class<?> type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out)
|
| private Method | |
| private static PropertyDescriptor | |
| private void | |
| protected void | initialize(Class<?>
the type of the instances type, Object The instance to be copied. oldInstance, Object The instance that is to be modified. newInstance, Encoder The stream to which any initialization statements should be written. out)Overrides java. This default implementation of the |
| protected Expression | Returns: An expression whose value isoldInstance.The instance to be instantiated. oldInstance, Encoder The code output stream. out)Implements abstract java. This default implementation of the |
| pack-priv static void | |
| protected boolean | Returns: True if an equivalent copy ofnewInstance may be
created by applying a series of mutations to oldInstance.The instance to be copied. oldInstance, Object The instance that is to be modified. newInstance)Overrides java. If the number of arguments in the specified constructor is non-zero and
the class of |
| constructor | back to summary |
|---|---|
| private final String[] constructor | |
| definesEquals | back to summary |
|---|---|
| private Boolean definesEquals | |
| EMPTY | back to summary |
|---|---|
| private static final String[] EMPTY | |
| DefaultPersistenceDelegate | back to summary |
|---|---|
| public DefaultPersistenceDelegate() Creates a persistence delegate for a class with a nullary constructor. | |
| DefaultPersistenceDelegate | back to summary |
|---|---|
| public DefaultPersistenceDelegate(String[] constructorPropertyNames) Creates a default persistence delegate for a class with a
constructor whose arguments are the values of the property
names as specified by
new DefaultPersistenceDelegate(new String[]{"name", "style", "size"});
| |
| definesEquals | back to summary |
|---|---|
| private static boolean definesEquals(Class<?> type) | |
| definesEquals | back to summary |
|---|---|
| private boolean definesEquals(Object instance) | |
| doProperty | back to summary |
|---|---|
| private void doProperty(Class<?> type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception | |
| findMethod | back to summary |
|---|---|
| private Method findMethod(Class<?> type, String property) | |
| getPropertyDescriptor | back to summary |
|---|---|
| private static PropertyDescriptor getPropertyDescriptor(Class<?> type, String property) | |
| initBean | back to summary |
|---|---|
| private void initBean(Class<?> type, Object oldInstance, Object newInstance, Encoder out) | |
| initialize | back to summary |
|---|---|
| protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) Overrides java. This default implementation of the
For each non-transient property, an expression is created
in which the nullary "getter" method is applied
to the
In passing these statements to the output stream, where they
will be executed, side effects are made to the
| |
| instantiate | back to summary |
|---|---|
| protected Expression instantiate(Object oldInstance, Encoder out) Implements abstract java. This default implementation of the
| |
| invokeStatement | back to summary |
|---|---|
| pack-priv static void invokeStatement(Object instance, String methodName, Object[] args, Encoder out) | |
| mutatesTo | back to summary |
|---|---|
| protected boolean mutatesTo(Object oldInstance, Object newInstance) Overrides java. If the number of arguments in the specified constructor is non-zero and
the class of
| |