@SuppressWarnings("unchecked")
private AttributeConverter<Object, Object> getConverter(AccessibleObject accessible) {
Convert converter = accessible.getAnnotation(Convert.class);
if (converter != null) {
Class<?> converterClass = converter.converter();
if (!AttributeConverter.class.isAssignableFrom(converterClass)) {
throw new RuntimeException(
"Converter class must be AttributeConverter rather than " + converterClass.getName());
}
try {
Constructor<?> cs = converterClass.getDeclaredConstructor();
cs.setAccessible(true);
return (AttributeConverter<Object, Object>) cs.newInstance();
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException
| InvocationTargetException e) {
throw new RuntimeException("Cannot instantiate Converter: " + converterClass.getName(), e);
}
}
return null;
}
AccessibleProperty.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:warpdb
作者:
评论列表
文章目录