((IndexedPropertyDescriptor) existingPd).setIndexedWriteMethod(method);
((IndexedPropertyDescriptor) existingPd).setIndexedWriteMethod(method);
existingIPD.setIndexedWriteMethod(null); existingIPD.setIndexedReadMethod(indexedReadMethod); existingIPD.setIndexedWriteMethod(indexedWriteMethod); ((IndexedPropertyDescriptor)pd).setIndexedReadMethod(indexedReadMethod); try { ((IndexedPropertyDescriptor)pd).setIndexedWriteMethod(indexedWriteMethod); } catch (IntrospectionException ex) { logger.debug(format("Could not add indexed write method [%s] for property [%s]. Reason: %s",
private void handleCandidateWriteMethod(Method method) throws IntrospectionException { int nParams = method.getParameterTypes().length; String propertyName = propertyNameFor(method); Class<?> propertyType = method.getParameterTypes()[nParams - 1]; PropertyDescriptor existingPd = findExistingPropertyDescriptor(propertyName, propertyType); if (nParams == 1) { if (existingPd == null) { this.propertyDescriptors.add(new SimplePropertyDescriptor(propertyName, null, method)); } else { existingPd.setWriteMethod(method); } } else if (nParams == 2) { if (existingPd == null) { this.propertyDescriptors.add( new SimpleIndexedPropertyDescriptor(propertyName, null, null, null, method)); } else if (existingPd instanceof IndexedPropertyDescriptor) { ((IndexedPropertyDescriptor) existingPd).setIndexedWriteMethod(method); } else { this.propertyDescriptors.remove(existingPd); this.propertyDescriptors.add(new SimpleIndexedPropertyDescriptor( propertyName, existingPd.getReadMethod(), existingPd.getWriteMethod(), null, method)); } } else { throw new IllegalArgumentException("Write method must have exactly 1 or 2 parameters: " + method); } }
private void handleCandidateWriteMethod(Method method) throws IntrospectionException { int nParams = method.getParameterTypes().length; String propertyName = propertyNameFor(method); Class<?> propertyType = method.getParameterTypes()[nParams - 1]; PropertyDescriptor existingPd = findExistingPropertyDescriptor(propertyName, propertyType); if (nParams == 1) { if (existingPd == null) { this.propertyDescriptors.add(new SimplePropertyDescriptor(propertyName, null, method)); } else { existingPd.setWriteMethod(method); } } else if (nParams == 2) { if (existingPd == null) { this.propertyDescriptors.add( new SimpleIndexedPropertyDescriptor(propertyName, null, null, null, method)); } else if (existingPd instanceof IndexedPropertyDescriptor) { ((IndexedPropertyDescriptor) existingPd).setIndexedWriteMethod(method); } else { this.propertyDescriptors.remove(existingPd); this.propertyDescriptors.add(new SimpleIndexedPropertyDescriptor( propertyName, existingPd.getReadMethod(), existingPd.getWriteMethod(), null, method)); } } else { throw new IllegalArgumentException("Write method must have exactly 1 or 2 parameters: " + method); } }
((IndexedPropertyDescriptor) existingPd).setIndexedWriteMethod(method);