Just did some more digging.
It seems like is- method works quite fine.
OJB uses java.bean.PropertyDescriptor to find the setter-method.
And the code there looks like this:
// Since there can be multiple setter methods but only one
getter
// method, find the getter method first so that you know what the
// property type is. For booleans, there can be "is" and "get"
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
try {
readMethod = Introspector.findMethod(beanClass, "is" + base,
0);
} catch (Exception getterExc) {
// no "is" method, so look for a "get" method.
readMethod = Introspector.findMethod(beanClass, "get" +
base, 0);
So no problem here.
I think the problem is the name of your property.
"default" is a reserved java keyword so you cannot use it as a property
name.
My guess is that you have called the property "isDefault" and thus you
have to use
getIsDefault() and setIsDefault() as accessor methods, or ..
isIsDefault().
My apologies to Thomas for accusing OJB for this.
/Soee
-----Oprindelig meddelelse-----
Fra: Anders S�e [mailto:[EMAIL PROTECTED]]
Sendt: 3. september 2002 21:36
Til: 'OJB Users List'
Emne: SV: getters/setters naming question
According to Suns JavaBeans spec at
http://java.sun.com/products/javabeans/docs/beans.101.pdf
(section 8.3.2)
both the getDefault() and isDefault() methods are valid for boolean
properties. The latter is preferred though, and i have never seen the
first used except in OJB. Yet another thing for the ToDo-list ? :)
/Soee
-----Oprindelig meddelelse-----
Fra: Mahler Thomas [mailto:[EMAIL PROTECTED]]
Sendt: 3. september 2002 11:03
Til: 'OJB Users List'
Emne: AW: getters/setters naming question
Hi,
> -----Urspr�ngliche Nachricht-----
> Von: Andrey Chernyh [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 3. September 2002 10:41
> An: OJB Users List
> Betreff: getters/setters naming question
>
>
> Hello!
>
> I have field named "default"
> I use PersistentFieldClass=org.apache.ojb.broker.metadata.Persistent
> FieldPropertyImpl in OJB.properties
>
> I want my access methods to be called
> isDefault()
> setDefault(),
> but now I must call them setIsDefault() and getIsDefailt() because of
> PersistentFieldClass rules.
Not because of our rules but because of JavaBeans rules.
>
> Is there any solution for this case?
You use a BeanInfo class to declare spcif getter/setter methods.
cheers,
Thomas
> Is it possible to use different PersistentFieldClass settings for
> different classes?
>
> Thanks.
>
>
> --
> Best regards,
> Andrey mailto:[EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>