私が持っている Bean クラスの 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」にあります
考え?