[jboss-cvs] Re: jboss-cvs-commits Digest, Vol 37, Issue 197
Scott Stark
sstark at redhat.com
Tue Jul 14 16:20:24 EDT 2009
The problem with "is" style getters is that it only applies to the
primitive boolean type.
Boolean isX()
void setX(Boolean x)
does not define a read-write property X of type Boolean. This has burned
me in setup of some management views where a property shows up with no
read based on the mc BeanInfo. I personally like get/set as it has no
such inconsistency.
Brian Stansberry wrote:
> If you prefer "is" I'll gladly change it. I'm curious why you care
> though; does the MC handle "is" more cleanly?
>
> Regarding the javabeans spec, the only preference for "is" is that if
> "is" and "get" both exist for a property, the property is read via "is".
>
> 8.3 Design Patterns for Properties
> 8.3.1 Simple properties
> By default, we use design patterns to locate properties by
> looking for methods of the form:
> public <PropertyType> get<PropertyName>();
> public void set<PropertyName>(<PropertyType> a);
>
> .....
>
> 8.3.2 Boolean properties
> In addition, for boolean properties, we allow a getter method
> to match the pattern:
> public boolean is<PropertyName>();
> This “is<PropertyName>” method may be provided instead of a
> “get<PropertyName>” method, or it may be provided in addition to a
> “get<PropertyName>” method.
>
> In either case, if the “is<PropertyName>” method is present
> for a boolean property then we will use the “is<PropertyName>” method
> to read the property value.
>
>
> Ales Justin wrote:
>> Why is this not isOverrideDistributableManager(), as per javabeans?
>>
>>
>
More information about the jboss-cvs-commits
mailing list