* @param targetType
* the target type (representing a JavaBean).
* @return an instance of the specified target type.
*/
private Object getBeanMatchingValue(Class targetType) {
BeanWrapper beanWrapper = new BeanWrapperImpl(targetType);
boolean matching = true;
int memberCount = members.size();
for (int i = 0; i < memberCount; i++) {
XmlRpcMember member = (XmlRpcMember) members.get(i);
String propertyName = member.name;
if (beanWrapper.isWritableProperty(propertyName)) {
Class propertyType = beanWrapper.getPropertyType(propertyName);
Object propertyValue = member.value.getMatchingValue(propertyType);
if (propertyValue == NOT_MATCHING) {
matching = false;
break;
}
beanWrapper.setPropertyValue(propertyName, propertyValue);
} else {
matching = false;
break;
}
}
Object matchingValue = null;
if (matching) {
matchingValue = beanWrapper.getWrappedInstance();
} else {
matchingValue = NOT_MATCHING;
}
return matchingValue;