原来的
package io.github.yfblock.test.Runners;
import io.github.yfblock.test.Bean.User;
import io.github.yfblock.yfSql.Annotation.DataRunner;
import io.github.yfblock.yfSql.Annotation.Select;
import java.sql.SQLException;
import java.util.List;
@DataRunner
public class TestService {
// private SqlRunner sqlRunner;
@Select("select id, username from user")
public List<User> getUsers() throws SQLException {
return null;
}
}
目标:
package io.github.yfblock.test;
import io.github.yfblock.test.Bean.User;
import io.github.yfblock.yfSql.Annotation.DataRunner;
import io.github.yfblock.yfSql.Annotation.Select;
import java.sql.SQLException;
import java.util.List;
@DataRunner
public interface TestInterface {
@Select("select id, username from user")
public List<User> getUsers() throws SQLException;
}
预计方案:利用 JavaParser 生成类,然后利用注解处理器将初始化函数插入到注解存在的位置。