< prev index next >
src/java.desktop/share/classes/java/beans/Introspector.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1996, 2015, 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) 1996, 2018, 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
*** 119,129 ****
private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<>();
private Class<?> beanClass;
private BeanInfo explicitBeanInfo;
private BeanInfo superBeanInfo;
! private BeanInfo additionalBeanInfo[];
private boolean propertyChangeSource = false;
// These should be removed.
private String defaultEventName;
--- 119,129 ----
private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<>();
private Class<?> beanClass;
private BeanInfo explicitBeanInfo;
private BeanInfo superBeanInfo;
! private BeanInfo[] additionalBeanInfo;
private boolean propertyChangeSource = false;
// These should be removed.
private String defaultEventName;
*** 320,330 ****
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
! char chars[] = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
/**
--- 320,330 ----
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
! char[] chars = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
/**
*** 457,469 ****
// the evaluation order here is import, as we evaluate the
// event sets and locate PropertyChangeListeners before we
// look for properties.
BeanDescriptor bd = getTargetBeanDescriptor();
! MethodDescriptor mds[] = getTargetMethodInfo();
! EventSetDescriptor esds[] = getTargetEventInfo();
! PropertyDescriptor pds[] = getTargetPropertyInfo();
int defaultEvent = getTargetDefaultEventIndex();
int defaultProperty = getTargetDefaultPropertyIndex();
return new GenericBeanInfo(bd, esds, defaultEvent, pds,
--- 457,469 ----
// the evaluation order here is import, as we evaluate the
// event sets and locate PropertyChangeListeners before we
// look for properties.
BeanDescriptor bd = getTargetBeanDescriptor();
! MethodDescriptor[] mds = getTargetMethodInfo();
! EventSetDescriptor[] esds = getTargetEventInfo();
! PropertyDescriptor[] pds = getTargetPropertyInfo();
int defaultEvent = getTargetDefaultEventIndex();
int defaultProperty = getTargetDefaultPropertyIndex();
return new GenericBeanInfo(bd, esds, defaultEvent, pds,
*** 524,534 ****
}
}
processPropertyDescriptors();
// Allocate and populate the result array.
! PropertyDescriptor result[] =
properties.values().toArray(new PropertyDescriptor[properties.size()]);
// Set the default index.
if (defaultPropertyName != null) {
for (int i = 0; i < result.length; i++) {
--- 524,534 ----
}
}
processPropertyDescriptors();
// Allocate and populate the result array.
! PropertyDescriptor[] result =
properties.values().toArray(new PropertyDescriptor[properties.size()]);
// Set the default index.
if (defaultPropertyName != null) {
for (int i = 0; i < result.length; i++) {
*** 922,943 ****
}
}
if (explicitEvents == null && superBeanInfo != null) {
// We have no explicit BeanInfo events. Check with our parent.
! EventSetDescriptor supers[] = superBeanInfo.getEventSetDescriptors();
for (int i = 0 ; i < supers.length; i++) {
addEvent(supers[i]);
}
int ix = superBeanInfo.getDefaultEventIndex();
if (ix >= 0 && ix < supers.length) {
defaultEventName = supers[ix].getName();
}
}
for (int i = 0; i < additionalBeanInfo.length; i++) {
! EventSetDescriptor additional[] = additionalBeanInfo[i].getEventSetDescriptors();
if (additional != null) {
for (int j = 0 ; j < additional.length; j++) {
addEvent(additional[j]);
}
}
--- 922,943 ----
}
}
if (explicitEvents == null && superBeanInfo != null) {
// We have no explicit BeanInfo events. Check with our parent.
! EventSetDescriptor[] supers = superBeanInfo.getEventSetDescriptors();
for (int i = 0 ; i < supers.length; i++) {
addEvent(supers[i]);
}
int ix = superBeanInfo.getDefaultEventIndex();
if (ix >= 0 && ix < supers.length) {
defaultEventName = supers[ix].getName();
}
}
for (int i = 0; i < additionalBeanInfo.length; i++) {
! EventSetDescriptor[] additional = additionalBeanInfo[i].getEventSetDescriptors();
if (additional != null) {
for (int j = 0 ; j < additional.length; j++) {
addEvent(additional[j]);
}
}
*** 1018,1035 ****
explicitMethods = explicitBeanInfo.getMethodDescriptors();
}
if (explicitMethods == null && superBeanInfo != null) {
// We have no explicit BeanInfo methods. Check with our parent.
! MethodDescriptor supers[] = superBeanInfo.getMethodDescriptors();
for (int i = 0 ; i < supers.length; i++) {
addMethod(supers[i]);
}
}
for (int i = 0; i < additionalBeanInfo.length; i++) {
! MethodDescriptor additional[] = additionalBeanInfo[i].getMethodDescriptors();
if (additional != null) {
for (int j = 0 ; j < additional.length; j++) {
addMethod(additional[j]);
}
}
--- 1018,1035 ----
explicitMethods = explicitBeanInfo.getMethodDescriptors();
}
if (explicitMethods == null && superBeanInfo != null) {
// We have no explicit BeanInfo methods. Check with our parent.
! MethodDescriptor[] supers = superBeanInfo.getMethodDescriptors();
for (int i = 0 ; i < supers.length; i++) {
addMethod(supers[i]);
}
}
for (int i = 0; i < additionalBeanInfo.length; i++) {
! MethodDescriptor[] additional = additionalBeanInfo[i].getMethodDescriptors();
if (additional != null) {
for (int j = 0 ; j < additional.length; j++) {
addMethod(additional[j]);
}
}
*** 1047,1057 ****
addMethod(new MethodDescriptor(method));
}
}
// Allocate and populate the result array.
! MethodDescriptor result[] = new MethodDescriptor[methods.size()];
result = methods.values().toArray(result);
return result;
}
--- 1047,1057 ----
addMethod(new MethodDescriptor(method));
}
}
// Allocate and populate the result array.
! MethodDescriptor[] result = new MethodDescriptor[methods.size()];
result = methods.values().toArray(result);
return result;
}
*** 1153,1163 ****
}
private boolean isEventHandler(Method m) {
// We assume that a method is an event handler if it has a single
// argument, whose type inherit from java.util.Event.
! Type argTypes[] = m.getGenericParameterTypes();
if (argTypes.length != 1) {
return false;
}
return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
--- 1153,1163 ----
}
private boolean isEventHandler(Method m) {
// We assume that a method is an event handler if it has a single
// argument, whose type inherit from java.util.Event.
! Type[] argTypes = m.getGenericParameterTypes();
if (argTypes.length != 1) {
return false;
}
return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
*** 1169,1179 ****
/**
* Internal support for finding a target methodName with a given
* parameter list on a given class.
*/
private static Method internalFindMethod(Class<?> start, String methodName,
! int argCount, Class<?> args[]) {
// For overriden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
for (Method method : ClassInfo.get(cl).getMethods()) {
// make sure method signature matches.
--- 1169,1179 ----
/**
* Internal support for finding a target methodName with a given
* parameter list on a given class.
*/
private static Method internalFindMethod(Class<?> start, String methodName,
! int argCount, Class<?>[] args) {
// For overriden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
for (Method method : ClassInfo.get(cl).getMethods()) {
// make sure method signature matches.
< prev index next >