Package org.apache.openjpa.enhance
Class PCSubclassValidator
java.lang.Object
org.apache.openjpa.enhance.PCSubclassValidator
Validates that a given type meets the JPA contract, plus a few OpenJPA-specific additions for subclassing / redefinition:
- must have an accessible no-args constructor
- must be a public or protected class
- must not be final
- must not extend an enhanced class
- all persistent data represented by accessible setter/getter methods (persistent properties)
- if versioning is to be used, exactly one persistent property for the numeric version data
- When using property access, the backing field for a persistent
property must be:
- private
- set only in the designated setter,
in the constructor, or in
Object.clone()
,readObject(ObjectInputStream)
, orExternalizable.readExternal(ObjectInput)
. - read only in the designated getter and the constructor.
If you use this technique and use the new
keyword instead
of a OpenJPA-supplied construction routine, OpenJPA will need to do extra
work with persistent-new-flushed instances, since OpenJPA cannot in this
case track what happens to such an instance.
- Since:
- 1.0.0
-
Constructor Summary
ConstructorDescriptionPCSubclassValidator
(ClassMetaData meta, org.apache.xbean.asm9.tree.ClassNode classNode, Log log, boolean enforceContractViolations) -
Method Summary
-
Constructor Details
-
PCSubclassValidator
public PCSubclassValidator(ClassMetaData meta, org.apache.xbean.asm9.tree.ClassNode classNode, Log log, boolean enforceContractViolations)
-
-
Method Details
-
assertCanSubclass
public void assertCanSubclass()
-