Created
November 4, 2017 13:46
-
-
Save nakamura-to/7f92d7e16810615d5f7d19a72d744e84 to your computer and use it in GitHub Desktop.
可視性がパッケージレベルのDaoを使う
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
public interface FooDao { | |
public default <R> R findByIds(List<FooId> ids, Collector<Foo, ?, R> collctor) { | |
FooInteranlDao dao = DaoFactory.get(FooInteranlDao.class); | |
return Lists.partition(ids, 5000).stream() // partition は List<A> を 第二引数の数ごと区切ってList<List<A>> にする処理です | |
flatMap(dao::findByIdsInternally) | |
collect(collctor); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao(accessLevel = AccessLevel.PACKAGE) | |
interface FooInteranlDao { | |
@Select(strategy = SelectType.STREAM) | |
@Suppress(messages = { Message.DOMA4274 }) | |
Stream<Foo> findByIdsInternally(List<FooId> ids); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment