hints.put(hint.name(), hint.stringValue());
}
}
// create the PropertyDescriptor
PropertyDescriptor prop = new PropertyDescriptor();
prop.setName(pd.getName());
prop.setFieldName(propField);
prop.setGetter(pd.getReadMethod());
prop.setSetter(pd.getWriteMethod());
prop.setIdentifier(propIsIdentifier);
prop.setType(JavaType.fromType(propType));
prop.setAutoGenerated(propIsAutoGen);
prop.setConversionHints(hints);
prop.setGenericParameterTypes(genericParameterTypes);
if (propIsAutoGen) {
ValueGenerator<?> valueGenerator = null;
if (valueGeneratorClass==null) {
valueGenerator = ObjectIdValueGenerator.INSTANCE;
storageType = ObjectId.class;
} else {
try {
valueGenerator = ValueGenerator.class.cast(valueGeneratorClass.newInstance());
} catch(Exception e) {
throw new IllegalArgumentException(
"Unable to create ValueGenerator for "+valueGeneratorClass.getName(), e);
}
}
prop.setValueGenerator(valueGenerator);
}
// set the storage type
if (storageType!=null) {
prop.setStorageType(JavaType.fromType(storageType));
}
// add to descriptor
desc.addPropertyDescriptor(prop);
}