376 throw new IntrospectionException("non int index to indexed write method"); 377 } 378 if (indexedPropertyType == null || params[1].isAssignableFrom(indexedPropertyType)) { 379 indexedPropertyType = params[1]; 380 } else if (!indexedPropertyType.isAssignableFrom(params[1])) { 381 throw new IntrospectionException( 382 "type mismatch between indexed read and indexed write methods: " 383 + getName()); 384 } 385 } 386 Class<?> propertyType = getPropertyType(); 387 if (propertyType != null && (!propertyType.isArray() || 388 propertyType.getComponentType() != indexedPropertyType)) { 389 throw new IntrospectionException("type mismatch between indexed and non-indexed methods: " 390 + getName()); 391 } 392 return indexedPropertyType; 393 } 394 395 /** 396 * Compares this <code>PropertyDescriptor</code> against the specified object. 397 * Returns true if the objects are the same. Two <code>PropertyDescriptor</code>s 398 * are the same if the read, write, property types, property editor and 399 * flags are equivalent. 400 * 401 * @since 1.4 402 */ 403 public boolean equals(Object obj) { 404 // Note: This would be identical to PropertyDescriptor but they don't 405 // share the same fields. 406 if (this == obj) { 407 return true; 408 } 409 410 if (obj != null && obj instanceof IndexedPropertyDescriptor) { 411 IndexedPropertyDescriptor other = (IndexedPropertyDescriptor)obj; 412 Method otherIndexedReadMethod = other.getIndexedReadMethod(); 413 Method otherIndexedWriteMethod = other.getIndexedWriteMethod(); 414 415 if (!compareMethods(getIndexedReadMethod(), otherIndexedReadMethod)) { 416 return false; 417 } | 376 throw new IntrospectionException("non int index to indexed write method"); 377 } 378 if (indexedPropertyType == null || params[1].isAssignableFrom(indexedPropertyType)) { 379 indexedPropertyType = params[1]; 380 } else if (!indexedPropertyType.isAssignableFrom(params[1])) { 381 throw new IntrospectionException( 382 "type mismatch between indexed read and indexed write methods: " 383 + getName()); 384 } 385 } 386 Class<?> propertyType = getPropertyType(); 387 if (propertyType != null && (!propertyType.isArray() || 388 propertyType.getComponentType() != indexedPropertyType)) { 389 throw new IntrospectionException("type mismatch between indexed and non-indexed methods: " 390 + getName()); 391 } 392 return indexedPropertyType; 393 } 394 395 /** 396 * Compares this {@code PropertyDescriptor} against the specified object. 397 * Returns true if the objects are the same. Two {@code PropertyDescriptor}s 398 * are the same if the read, write, property types, property editor and 399 * flags are equivalent. 400 * 401 * @since 1.4 402 */ 403 public boolean equals(Object obj) { 404 // Note: This would be identical to PropertyDescriptor but they don't 405 // share the same fields. 406 if (this == obj) { 407 return true; 408 } 409 410 if (obj != null && obj instanceof IndexedPropertyDescriptor) { 411 IndexedPropertyDescriptor other = (IndexedPropertyDescriptor)obj; 412 Method otherIndexedReadMethod = other.getIndexedReadMethod(); 413 Method otherIndexedWriteMethod = other.getIndexedWriteMethod(); 414 415 if (!compareMethods(getIndexedReadMethod(), otherIndexedReadMethod)) { 416 return false; 417 } |