Returns the persistence delegate for the given type. The persistence delegate is calculated by applying the following rules in order:
setPersistenceDelegate method
it is returned.
Bean class
should be named BeanPersistenceDelegate
and located in the same package.
public class Bean { ... }
public class BeanPersistenceDelegate { ... }
The instance of the BeanPersistenceDelegate class
is returned for the Bean class.
null,
a shared internal persistence delegate is returned
that encodes null value.
enum declaration,
a shared internal persistence delegate is returned
that encodes constants of this enumeration
by their names.
java.lang.reflect.Proxy.newProxyInstance method.
BeanInfo for this type has a BeanDescriptor
which defined a "persistenceDelegate" attribute,
the value of this named attribute is returned.
Introspector class.
The default constructor is the constructor with the greatest number
of parameters that has the ConstructorProperties annotation.
If none of the constructors has the ConstructorProperties annotation,
then the nullary constructor (constructor with no parameters) will be used.
For example, in the following code fragment, the nullary constructor
for the Foo class will be used,
while the two-parameter constructor
for the Bar class will be used.
public class Foo {
public Foo() { ... }
public Foo(int x) { ... }
}
public class Bar {
public Bar() { ... }
@ConstructorProperties({"x"})
public Bar(int x) { ... }
@ConstructorProperties({"x", "y"})
public Bar(int x, int y) { ... }
}
type | the class of the objects |
setPersistenceDelegate, java.beans.Introspector.getBeanInfo, java.beans.BeanInfo.getBeanDescriptor
Diagram: Persistence