Class objectClass =
Class.forName(getClassName(), true, getClassLoader());
Object object = objectClass.newInstance();
// Set all configured bean properties
BeanMap map = new BeanMap(object);
Iterator iterator = map.keyIterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
String value = properties.getProperty(name);
if (value != null) {
map.put(name, properties.getProperty(name));
}
}
if (validate) {
// Check that no invalid property names were configured
Iterator it = properties.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
if (!map.containsKey(key) && properties.getProperty(key) != null) {
String msg =
"Configured class " + object.getClass().getName()
+ " does not contain the property " + key
+ ". Please fix the repository configuration.";
log.error(msg);