「Java8開発」@FunctionalInterfaceアノテーションの使い方

1.インターフェースの定義
@FunctionalInterface
public abstract interface IResultSetParser<T> {
public abstract T toBeanFunc(ResultSet rs) throws SQLException;

}

2.インターフェースの実現
public static class ResultToBean implements OPTool.IResultSetParser<DemoInfo> {
public DemoInfo toBeanFunc(ResultSet rs) throws SQLException {
DemoInfo cft = new DemoInfo();
if (rs.next()) {
//some code
}
return cft;
}
}

Java

Posted by arkgame