// this is ok, but certainly log this as a warning
// this is hugely noisy!
//if (log.isWarnEnabled()) log.warn("Unrecognised attribute " + propName + ". Please check your configuration. Ignoring!!");
}
catch (Exception e) {
throw new CacheConfigurationException("Unable to invoke setter " + setter + " on " + objectClass, e);
}
boolean setterFound = false;
// if we get here, we could not find a String or Element setter.
for (Method m : objectClass.getMethods()) {
if (setter.equals(m.getName()) || fluentSetter.equals(m.getName())) {
Class<?> paramTypes[] = m.getParameterTypes();
if (paramTypes.length != 1) {
log.tracef("Rejecting setter %s on class %s due to incorrect number of parameters", m, objectClass);
continue; // try another param with the same name.
}
Class<?> parameterType = paramTypes[0];
PropertyEditor editor = PropertyEditorManager.findEditor(parameterType);
if (editor == null) {
throw new CacheConfigurationException("Couldn't find a property editor for parameter type " + parameterType);
}
editor.setAsText((String) attribs.get(propName));
Object parameter = editor.getValue();
//if (log.isDebugEnabled()) log.debug("Invoking setter method: " + setter + " with parameter \"" + parameter + "\" of type " + parameter.getClass());
try {
m.invoke(target, parameter);
setterFound = true;
break;
}
catch (Exception e) {
throw new CacheConfigurationException("Unable to invoke setter " + setter + " on " + objectClass, e);
}
}
}
// Skip hot rod properties ...
if (!setterFound && !propName.startsWith("infinispan.client.hotrod"))
if (failOnMissingSetter) {
throw new CacheConfigurationException("Couldn't find a setter named [" + setter + "] which takes a single parameter, for parameter " + propName + " on class [" + objectClass + "]");
} else {
ignoredAttribs.put(propName, attribs.get(propName));
}
}
return ignoredAttribs;