ModelUtils.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:easy-mybatis 作者:
public static String getRecVersionColumnName(Class<? extends BaseMybatisModel> modelClass) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
    for (Method method : modelClass.getMethods()) {
        if (method.isAnnotationPresent(Version.class)) {
            for (int i = 0; i < method.getAnnotations().length; i++) {
                Annotation annotation = method.getAnnotations()[i];
                if (annotation.annotationType().equals(Column.class)) {
                    Method annotationMethod = annotation.getClass().getDeclaredMethod("name", method.getParameterTypes());
                    return annotationMethod.invoke(annotation, null).toString();
                }
            }
        }
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号