Browse Source

Stop using PropertyDescriptor, it requries a getter/setter pair.

Change-Id: I9a83f5f9cf80900d8eeda13164c4e5bfe869acc6
Fixes-Issue: CLIENT-443
Reviewed-on: http://gerrit.dmdirc.com/3177
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes 10 years ago
parent
commit
539596bc13

+ 6
- 9
src/com/dmdirc/addons/ui_swing/components/renderers/PropertyListCellRenderer.java View File

@@ -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;

Loading…
Cancel
Save