Запутанное поведение java.beans.PropertyDescriptor (String, Class)

Я пытаюсь создать PropertyDescriptor для имеющегося у меня класса компонентов. Я звоню

new PropertyDescriptor(myProperty, myClass)

и вижу исключение, что метод «isMyProperty» не существует. Немного заглянув в код--

/**
 * Constructs a PropertyDescriptor for a property that follows
 * the standard Java convention by having getFoo and setFoo
 * accessor methods.  Thus if the argument name is "fred", it will
 * assume that the writer method is "setFred" and the reader method
 * is "getFred" (or "isFred" for a boolean property).  Note that the
 * property name should start with a lower case character, which will
 * be capitalized in the method names.
 *
 * @param propertyName The programmatic name of the property.
 * @param beanClass The Class object for the target bean.  For
 *      example sun.beans.OurButton.class.
 * @exception IntrospectionException if an exception occurs during
 *              introspection.
 */
public PropertyDescriptor(String propertyName, Class<?> beanClass)
    throws IntrospectionException {
this(propertyName, beanClass, 
     "is" + capitalize(propertyName), 
     "set" + capitalize(propertyName));
}

В документации сказано, что он будет искать «getFred», но всегда использует "is" + capitalize(property)! Это в версии java "1.6.0 _31"

Мысли?

6
задан Steven Schlansker 24 April 2012 в 17:32
поделиться