|
@@ -22,8 +22,6 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.ui_swing.components.renderers;
|
24
|
24
|
|
25
|
|
-import java.beans.IntrospectionException;
|
26
|
|
-import java.beans.PropertyDescriptor;
|
27
|
25
|
import java.lang.reflect.Method;
|
28
|
26
|
|
29
|
27
|
import javax.swing.ListCellRenderer;
|
|
@@ -53,15 +51,14 @@ public class PropertyListCellRenderer<E> extends MethodListCellRenderer<E> {
|
53
|
51
|
}
|
54
|
52
|
|
55
|
53
|
private static <E> Method getMethod(final String property, final Class<E> type) {
|
56
|
|
- final PropertyDescriptor propertyDescriptor;
|
57
|
54
|
Method readMethod;
|
58
|
55
|
try {
|
59
|
|
- propertyDescriptor = new PropertyDescriptor(property, type);
|
60
|
|
- readMethod = propertyDescriptor.getReadMethod();
|
61
|
|
- if (readMethod == null || readMethod.getReturnType() != String.class) {
|
62
|
|
- readMethod = getToStringMethod(type);
|
63
|
|
- }
|
64
|
|
- } catch (IntrospectionException ex) {
|
|
56
|
+ readMethod = type.getMethod("get" + (property.substring(0, 1).toUpperCase() + property.
|
|
57
|
+ substring(1)));
|
|
58
|
+ } catch (NoSuchMethodException | SecurityException ex) {
|
|
59
|
+ readMethod = getToStringMethod(type);
|
|
60
|
+ }
|
|
61
|
+ if (readMethod == null || readMethod.getReturnType() != String.class) {
|
65
|
62
|
readMethod = getToStringMethod(type);
|
66
|
63
|
}
|
67
|
64
|
return readMethod;
|