db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@jpox.org>
Subject Enhancement of persistent properties
Date Sat, 10 Nov 2007 08:27:28 GMT
In the current spec section 23 (JDO reference enhancer), the mention of 
jdoGetXXX, jdoSetXXX are in relation to persistent fields, and those methods 
are static since its trivial to have a static method that sets a field of an 
instance to a value. In terms of enhancement if the user had
int getId()
{
    return id;
}
this is converted to (in general terms)
int getId()
{
    ... checks on StateManager as appropriate for the field
    return jdoGetXXX();
}
static int jdoGetXXX(Object inst)
{
    return inst.id;
}

In the case of persistent properties it is no longer trivial since the 
getXXX() for example could have significant code. If the user has
int getId()
{
    ... complicated logic for generating a value using the various fields
    return val;
}
then JPOX generates
int getId()
{
    ... checks on StateManager as appropriate for the field
    return jdoGetXXX();
}
int jdoGetXXX()
{
    ... complicated logic for generating a value using the various fields
    return val;
}

Consequently the jdoGetXXX, jdoSetXXX are no longer static. This has no 
detrimental effect on anything, just that we could have a mention in the spec 
section 23.20 to this effect.

-- 
Andy  (Java Persistent Objects - http://www.jpox.org)

Mime
View raw message