336 } 337 338 // Private methods which set get/set the Reference objects 339 340 private void setIndexedPropertyType(Class<?> type) { 341 this.indexedPropertyTypeRef = getWeakReference(type); 342 } 343 344 private Class<?> getIndexedPropertyType0() { 345 return (this.indexedPropertyTypeRef != null) 346 ? this.indexedPropertyTypeRef.get() 347 : null; 348 } 349 350 private Class<?> findIndexedPropertyType(Method indexedReadMethod, 351 Method indexedWriteMethod) 352 throws IntrospectionException { 353 Class<?> indexedPropertyType = null; 354 355 if (indexedReadMethod != null) { 356 Class params[] = getParameterTypes(getClass0(), indexedReadMethod); 357 if (params.length != 1) { 358 throw new IntrospectionException("bad indexed read method arg count"); 359 } 360 if (params[0] != Integer.TYPE) { 361 throw new IntrospectionException("non int index to indexed read method"); 362 } 363 indexedPropertyType = getReturnType(getClass0(), indexedReadMethod); 364 if (indexedPropertyType == Void.TYPE) { 365 throw new IntrospectionException("indexed read method returns void"); 366 } 367 } 368 if (indexedWriteMethod != null) { 369 Class params[] = getParameterTypes(getClass0(), indexedWriteMethod); 370 if (params.length != 2) { 371 throw new IntrospectionException("bad indexed write method arg count"); 372 } 373 if (params[0] != Integer.TYPE) { 374 throw new IntrospectionException("non int index to indexed write method"); 375 } 376 if (indexedPropertyType == null || params[1].isAssignableFrom(indexedPropertyType)) { 377 indexedPropertyType = params[1]; 378 } else if (!indexedPropertyType.isAssignableFrom(params[1])) { 379 throw new IntrospectionException( 380 "type mismatch between indexed read and indexed write methods: " 381 + getName()); 382 } 383 } 384 Class<?> propertyType = getPropertyType(); 385 if (propertyType != null && (!propertyType.isArray() || 386 propertyType.getComponentType() != indexedPropertyType)) { 387 throw new IntrospectionException("type mismatch between indexed and non-indexed methods: " 388 + getName()); 389 } | 336 } 337 338 // Private methods which set get/set the Reference objects 339 340 private void setIndexedPropertyType(Class<?> type) { 341 this.indexedPropertyTypeRef = getWeakReference(type); 342 } 343 344 private Class<?> getIndexedPropertyType0() { 345 return (this.indexedPropertyTypeRef != null) 346 ? this.indexedPropertyTypeRef.get() 347 : null; 348 } 349 350 private Class<?> findIndexedPropertyType(Method indexedReadMethod, 351 Method indexedWriteMethod) 352 throws IntrospectionException { 353 Class<?> indexedPropertyType = null; 354 355 if (indexedReadMethod != null) { 356 Class<?>[] params = getParameterTypes(getClass0(), indexedReadMethod); 357 if (params.length != 1) { 358 throw new IntrospectionException("bad indexed read method arg count"); 359 } 360 if (params[0] != Integer.TYPE) { 361 throw new IntrospectionException("non int index to indexed read method"); 362 } 363 indexedPropertyType = getReturnType(getClass0(), indexedReadMethod); 364 if (indexedPropertyType == Void.TYPE) { 365 throw new IntrospectionException("indexed read method returns void"); 366 } 367 } 368 if (indexedWriteMethod != null) { 369 Class<?>[] params = getParameterTypes(getClass0(), indexedWriteMethod); 370 if (params.length != 2) { 371 throw new IntrospectionException("bad indexed write method arg count"); 372 } 373 if (params[0] != Integer.TYPE) { 374 throw new IntrospectionException("non int index to indexed write method"); 375 } 376 if (indexedPropertyType == null || params[1].isAssignableFrom(indexedPropertyType)) { 377 indexedPropertyType = params[1]; 378 } else if (!indexedPropertyType.isAssignableFrom(params[1])) { 379 throw new IntrospectionException( 380 "type mismatch between indexed read and indexed write methods: " 381 + getName()); 382 } 383 } 384 Class<?> propertyType = getPropertyType(); 385 if (propertyType != null && (!propertyType.isArray() || 386 propertyType.getComponentType() != indexedPropertyType)) { 387 throw new IntrospectionException("type mismatch between indexed and non-indexed methods: " 388 + getName()); 389 } |