private void initPersistenceType()
{
affirm(persistenceType == CC_PersistenceUnknown);
// check if class is known not to be changed
final EnhancerMetaData meta = env.getEnhancerMetaData();
if (meta.isKnownUnenhancableClass(className)) {
persistenceType = CC_Unenhancable;
return;
}
// check if class is persistence-capable
if (meta.isPersistenceCapableClass(className)) {
pcSuperClassName
= meta.getPersistenceCapableSuperClass(className);
pcRootClassName
= meta.getPersistenceCapableRootClass(className);
affirm(pcSuperClassName == null || pcRootClassName != null);
persistenceType
= (pcSuperClassName == null
? CC_PersistenceCapableRoot
: CC_PersistenceCapable);
//^olsen: assert consistency between Java and JDO metadata
affirm(!classFile.isInterface());
//affirm(!classFile.isInnerClass());
//^olsen: assert consistency between Java and JDO metadata
// disallow enhancing classes not derived from java.lang.Object
final ConstClass superConstClass = classFile.superName();
affirm(superConstClass != null);
// non-pc-root classes must not derive from java.lang.Object
affirm(pcSuperClassName == null
|| !superConstClass.asString().equals("java/lang/Object"));
// define the PC key owner class
pcKeyOwnerClassName = className;
while (meta.getKeyClass(pcKeyOwnerClassName) == null) {
final String pcSuperClassName
= meta.getPersistenceCapableSuperClass(
pcKeyOwnerClassName);
if (pcSuperClassName == null)
break;
pcKeyOwnerClassName = pcSuperClassName;
}
affirm(pcKeyOwnerClassName != null);
// define the PC super key owner class
pcSuperKeyOwnerClassName = pcSuperClassName;
if (pcSuperKeyOwnerClassName != null) {
while (meta.getKeyClass(pcSuperKeyOwnerClassName) == null) {
final String pcSuperClassName
= meta.getPersistenceCapableSuperClass(
pcSuperKeyOwnerClassName);
if (pcSuperClassName == null)
break;
pcSuperKeyOwnerClassName = pcSuperClassName;
}
affirm(pcKeyOwnerClassName != null);
}
keyClassName
= meta.getKeyClass(className);
superKeyClassName
= meta.getSuperKeyClass(className);
affirm(superKeyClassName == null || pcSuperClassName != null);
}
}