public PersistenceDelegate getPersistenceDelegate (Class<?> type)

Returns the persistence delegate for the given type. The persistence delegate is calculated by applying the following rules in order:

  1. If a persistence delegate is associated with the given type by using the setPersistenceDelegate method it is returned.
  2. A persistence delegate is then looked up by the name composed of the the fully qualified name of the given type and the "PersistenceDelegate" postfix. For example, a persistence delegate for the 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.
  3. If the type is null, a shared internal persistence delegate is returned that encodes null value.
  4. If the type is a enum declaration, a shared internal persistence delegate is returned that encodes constants of this enumeration by their names.
  5. If the type is a primitive type or the corresponding wrapper, a shared internal persistence delegate is returned that encodes values of the given type.
  6. If the type is an array, a shared internal persistence delegate is returned that encodes an array of the appropriate type and length, and each of its elements as if they are properties.
  7. If the type is a proxy, a shared internal persistence delegate is returned that encodes a proxy instance by using the java.lang.reflect.Proxy.newProxyInstance method.
  8. If the BeanInfo for this type has a BeanDescriptor which defined a "persistenceDelegate" attribute, the value of this named attribute is returned.
  9. In all other cases the default persistence delegate is returned. The default persistence delegate assumes the type is a JavaBean, implying that it has a default constructor and that its state may be characterized by the matching pairs of "setter" and "getter" methods returned by the 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) { ... }
     }

Parameters:
type    the class of the objects

Returns:  the persistence delegate for the given type

See also:
setPersistenceDelegate, java.beans.Introspector.getBeanInfo, java.beans.BeanInfo.getBeanDescriptor