95 if (propertyName == null || propertyName.length() == 0) {
96 throw new IntrospectionException("bad property name");
97 }
98 if ("".equals(readMethodName) || "".equals(writeMethodName)) {
99 throw new IntrospectionException("read or write method name should not be the empty string");
100 }
101 setName(propertyName);
102 setClass0(beanClass);
103
104 this.readMethodName = readMethodName;
105 if (readMethodName != null && getReadMethod() == null) {
106 throw new IntrospectionException("Method not found: " + readMethodName);
107 }
108 this.writeMethodName = writeMethodName;
109 if (writeMethodName != null && getWriteMethod() == null) {
110 throw new IntrospectionException("Method not found: " + writeMethodName);
111 }
112 // If this class or one of its base classes allow PropertyChangeListener,
113 // then we assume that any properties we discover are "bound".
114 // See Introspector.getTargetPropertyInfo() method.
115 Class[] args = { PropertyChangeListener.class };
116 this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
117 }
118
119 /**
120 * This constructor takes the name of a simple property, and Method
121 * objects for reading and writing the property.
122 *
123 * @param propertyName The programmatic name of the property.
124 * @param readMethod The method used for reading the property value.
125 * May be null if the property is write-only.
126 * @param writeMethod The method used for writing the property value.
127 * May be null if the property is read-only.
128 * @exception IntrospectionException if an exception occurs during
129 * introspection.
130 */
131 public PropertyDescriptor(String propertyName, Method readMethod, Method writeMethod)
132 throws IntrospectionException {
133 if (propertyName == null || propertyName.length() == 0) {
134 throw new IntrospectionException("bad property name");
135 }
|
95 if (propertyName == null || propertyName.length() == 0) {
96 throw new IntrospectionException("bad property name");
97 }
98 if ("".equals(readMethodName) || "".equals(writeMethodName)) {
99 throw new IntrospectionException("read or write method name should not be the empty string");
100 }
101 setName(propertyName);
102 setClass0(beanClass);
103
104 this.readMethodName = readMethodName;
105 if (readMethodName != null && getReadMethod() == null) {
106 throw new IntrospectionException("Method not found: " + readMethodName);
107 }
108 this.writeMethodName = writeMethodName;
109 if (writeMethodName != null && getWriteMethod() == null) {
110 throw new IntrospectionException("Method not found: " + writeMethodName);
111 }
112 // If this class or one of its base classes allow PropertyChangeListener,
113 // then we assume that any properties we discover are "bound".
114 // See Introspector.getTargetPropertyInfo() method.
115 Class<?>[] args = { PropertyChangeListener.class };
116 this.bound = null != Introspector.findMethod(beanClass, "addPropertyChangeListener", args.length, args);
117 }
118
119 /**
120 * This constructor takes the name of a simple property, and Method
121 * objects for reading and writing the property.
122 *
123 * @param propertyName The programmatic name of the property.
124 * @param readMethod The method used for reading the property value.
125 * May be null if the property is write-only.
126 * @param writeMethod The method used for writing the property value.
127 * May be null if the property is read-only.
128 * @exception IntrospectionException if an exception occurs during
129 * introspection.
130 */
131 public PropertyDescriptor(String propertyName, Method readMethod, Method writeMethod)
132 throws IntrospectionException {
133 if (propertyName == null || propertyName.length() == 0) {
134 throw new IntrospectionException("bad property name");
135 }
|