public class JdoCopyKeyFieldsFromObjectId2 extends ClassMethod
protected void jdoCopyKeyFieldsFromObjectId(Object object)
{
}
and for SingleFieldIdentity
protected void jdoCopyKeyFieldsFromObjectId(Object oid)
{
if (!(oid instanceof YYYIdentity))
throw new ClassCastException("key class is not YYYIdentity or null");
YYYIdentity o = (YYYIdentity) oid;
id = o.getKey();
}
and for user-supplied app identity
protected void jdoCopyKeyFieldsFromObjectId(Object oid)
{
if (!(oid instanceof UserPrimaryKey))
throw new ClassCastException("key class is not mydomain.UserPrimarKey or null");
UserPrimaryKey o = (UserPrimaryKey) oid;
try
{
zzz1 = o.zzz1;
zzz2 = o.zzz2;
}
catch(Exception e) {}
}
and for CompoundIdentity
protected void jdoCopyKeyFieldsFromObjectId(Object oid)
{
if (!(oid instanceof UserPrimaryKey))
throw new ClassCastException("key class is not mydomain.UserPrimarKey or null");
UserPrimaryKey o = (UserPrimaryKey) oid;
try
{
zzz1 = o.zzz1;
zzz2 = (ZZZ) this.jdoGetPersistenceManager().getObjectById(o.zzz, false);
}
catch (Exception e) {}
}
(the try-catch is for cases where we set the fields with reflection and it can throw an exception).
There are some differences for fields .v. properties and also if fields in the PK are private.access, argNames, argTypes, enhancer, exceptions, LOCALISER, methodName, returnType, visitor| Constructor and Description |
|---|
JdoCopyKeyFieldsFromObjectId2(ClassEnhancer enhancer,
String name,
int access,
Object returnType,
Object[] argTypes,
String[] argNames)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute()
Method to add the contents of the class method.
|
static JdoCopyKeyFieldsFromObjectId2 |
getInstance(ClassEnhancer enhancer) |
close, equals, getAccess, getClassEnhancer, getDescriptor, getMethodAdditionMessage, getName, getNamer, hashCode, initialise, initialisepublic JdoCopyKeyFieldsFromObjectId2(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames)
enhancer - ClassEnhancername - Name of methodaccess - Access typereturnType - Return typeargTypes - Argument typesargNames - Argument namespublic static JdoCopyKeyFieldsFromObjectId2 getInstance(ClassEnhancer enhancer)
public void execute()
execute in class ClassMethodCopyright © 2013. All Rights Reserved.