make/data/swingbeaninfo/sun/swing/BeanInfoUtils.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 120,130 ****
*
* @see java.beans#BeanInfo
* @see java.beans#PropertyDescriptor
* @see java.beans#FeatureDescriptor
*/
! public static PropertyDescriptor createPropertyDescriptor(Class cls, String name, Object[] args)
{
PropertyDescriptor pd = null;
try {
pd = new PropertyDescriptor(name, cls);
} catch (IntrospectionException e) {
--- 120,130 ----
*
* @see java.beans#BeanInfo
* @see java.beans#PropertyDescriptor
* @see java.beans#FeatureDescriptor
*/
! public static PropertyDescriptor createPropertyDescriptor(Class<?> cls, String name, Object[] args)
{
PropertyDescriptor pd = null;
try {
pd = new PropertyDescriptor(name, cls);
} catch (IntrospectionException e) {
*** 154,164 ****
else if (READMETHOD.equals(key)) {
String methodName = (String)value;
Method method;
try {
! method = cls.getMethod(methodName, new Class[0]);
pd.setReadMethod(method);
}
catch(Exception e) {
throwError(e, cls + " no such method as \"" + methodName + "\"");
}
--- 154,164 ----
else if (READMETHOD.equals(key)) {
String methodName = (String)value;
Method method;
try {
! method = cls.getMethod(methodName, new Class<?>[0]);
pd.setReadMethod(method);
}
catch(Exception e) {
throwError(e, cls + " no such method as \"" + methodName + "\"");
}
*** 166,177 ****
else if (WRITEMETHOD.equals(key)) {
String methodName = (String)value;
Method method;
try {
! Class type = pd.getPropertyType();
! method = cls.getMethod(methodName, new Class[]{type});
pd.setWriteMethod(method);
}
catch(Exception e) {
throwError(e, cls + " no such method as \"" + methodName + "\"");
}
--- 166,177 ----
else if (WRITEMETHOD.equals(key)) {
String methodName = (String)value;
Method method;
try {
! Class<?> type = pd.getPropertyType();
! method = cls.getMethod(methodName, new Class<?>[]{type});
pd.setWriteMethod(method);
}
catch(Exception e) {
throwError(e, cls + " no such method as \"" + methodName + "\"");
}
*** 213,225 ****
* "random object value".
*
* @see java.beans#BeanInfo
* @see java.beans#PropertyDescriptor
*/
! public static BeanDescriptor createBeanDescriptor(Class cls, Object[] args)
{
! Class customizerClass = null;
/* For reasons I don't understand, customizerClass is a
* readOnly property. So we have to find it and pass it
* to the constructor here.
*/
--- 213,225 ----
* "random object value".
*
* @see java.beans#BeanInfo
* @see java.beans#PropertyDescriptor
*/
! public static BeanDescriptor createBeanDescriptor(Class<?> cls, Object[] args)
{
! Class<?> customizerClass = null;
/* For reasons I don't understand, customizerClass is a
* readOnly property. So we have to find it and pass it
* to the constructor here.
*/
*** 240,254 ****
return bd;
}
static private PropertyDescriptor createReadOnlyPropertyDescriptor(
! String name, Class cls) throws IntrospectionException {
Method readMethod = null;
String base = capitalize(name);
! Class[] parameters = new Class[0];
// Is it a boolean?
try {
readMethod = cls.getMethod("is" + base, parameters);
} catch (Exception ex) {}
--- 240,254 ----
return bd;
}
static private PropertyDescriptor createReadOnlyPropertyDescriptor(
! String name, Class<?> cls) throws IntrospectionException {
Method readMethod = null;
String base = capitalize(name);
! Class<?>[] parameters = new Class<?>[0];
// Is it a boolean?
try {
readMethod = cls.getMethod("is" + base, parameters);
} catch (Exception ex) {}
*** 262,272 ****
return new PropertyDescriptor(name, readMethod, null);
}
try {
// Try indexed accessor pattern.
! parameters = new Class[1];
parameters[0] = int.class;
readMethod = cls.getMethod("get" + base, parameters);
} catch (NoSuchMethodException nsme) {
throw new IntrospectionException(
"cannot find accessor method for " + name + " property.");
--- 262,272 ----
return new PropertyDescriptor(name, readMethod, null);
}
try {
// Try indexed accessor pattern.
! parameters = new Class<?>[1];
parameters[0] = int.class;
readMethod = cls.getMethod("get" + base, parameters);
} catch (NoSuchMethodException nsme) {
throw new IntrospectionException(
"cannot find accessor method for " + name + " property.");