[jboss-cvs] Re: jboss-cvs-commits Digest, Vol 37, Issue 197
Brian Stansberry
brian.stansberry at redhat.com
Tue Jul 14 17:13:10 EDT 2009
Hehe. One reason I tend to use "get" not "is" is because I like
consistency. I.e. all the getters start with "get", sort together in the
eclipse Outline view etc. :)
The class in question isn't consistent; there are two other boolean
properties with "get" plus 2 more in the superclass. Once the hierarchy
gets into the MC classes, "is" is used consistently.
Ales Justin wrote:
> 2x true.
>
> But I still like the consistency with isX on primitives. :-)
>
> Scott Stark wrote:
>> 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?
>>>>
>>>>
>>>
>>
>>
--
Brian Stansberry
Lead, AS Clustering
JBoss by Red Hat
More information about the jboss-cvs-commits
mailing list