@Override
public void evaluate(Method method, EvaluatorChain chain) {
if (method.isAnnotationPresent(EmbeddedId.class)) {
Map<String, AttributeOverride> overrides = getAttributeOverrides(method);
Class<?> embeddedClz = method.getReturnType();
BeanInfo info = null;
try {
info = Introspector.getBeanInfo(embeddedClz);
} catch (IntrospectionException e) {
throw new RuntimeException(e);
}
for (String propertyName : overrides.keySet()) {
for (PropertyDescriptor propDesc : info.getPropertyDescriptors()) {
if (propDesc.getName().equals(propertyName)) {
CopyAttribute attribute = new CopyAttribute();
attribute.getMethods().add(method);
attribute.getMethods().add(propDesc.getReadMethod());
attribute.setColumnName(overrides.get(propertyName).column().name());
chain.add(attribute);
break;
}
}
}
} else {
chain.doNext();
}
}
EmbeddedIdColumnEvaluator.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:pedal-dialect
作者:
评论列表
文章目录