geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Laskowski <jlaskow...@apache.org>
Subject GAttributeInfo ctor and Re: GAttributeInfo Boolean vs. boolean
Date Thu, 11 Mar 2004 14:02:20 GMT
Dain Sundstrom wrote:
> That is the reason.  In the old system we had them as "boolean" and it 
> was a pain to have read-only or write-only.

I don't however understand one thing. According to GBeanMBeanAttribute 
ctor an attribute must be readable, writable or persistent. It's however 
possible to create the attribute via its public ctor that doesn't 
respect the policy, and moreover

    public GAttributeInfo(String name, boolean persistent, Boolean 
readable, Boolean writable, String getterName, String setterName)

allows to create an instance that although has readable set to true, but 
setterName is not supplied. It's not enforced. That's why a unit test of 
mine fails all the time, but it's supposed to work ;)

What about removing the ctor or change its body to:

     public GAttributeInfo(String name, boolean persistent, Boolean 
readable, Boolean writable, String getterName,
             String setterName) {
         this.name = name;
         this.persistent = persistent;
         this.readable = (readable == null ? Boolean.valueOf(getterName 
!= null) : readable);
         this.writable = (writable == null ? Boolean.valueOf(setterName 
!= null) : writable);
         this.getterName = getterName;
         this.setterName = setterName;
     }

so when readable/writable is null, it checks setterName/getterName.

Do we really need the ctor?

> -dain

Jacek

> 
> On Feb 20, 2004, at 11:39 AM, David Jencks wrote:
> 
> 
>>IIRC dain explained that null meant "you figure it out, based on 
>>introspection of getter/setter"
>>
>>david jencks
>>
>>On Friday, February 20, 2004, at 09:29 AM, Jeremy Boynes wrote:
>>
>>
>>>Is there a reason we can't make the readable and writable properties 
>>>plain boolean rather than java.lang.Boolean?
>>>
>>>-- 
>>>Jeremy
>>>
> 
>>


Mime
View raw message