Last active
November 19, 2017 07:06
-
-
Save gakuzzzz/bb814e3fdb9f3e749a801300fda6d557 to your computer and use it in GitHub Desktop.
Doma2 で IN 句の最大数を固定したメソッドだけ public にしたい
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
package example | |
import 省略 | |
public interface FooDao { | |
/** Doma2 が生成するこのメソッドは private にしたい。 */ | |
@Select(strategy = SelectType.STREAM) | |
@Suppress(messages = { Message.DOMA4274 }) | |
private Stream<Foo> findByIdsInternally(List<FooId> ids); | |
/** こっちだけ public にしたい */ | |
public default <R> R findByIds(List<FooId> ids, Collector<Foo, ?, R> collctor) { | |
return Lists.partition(ids, 5000).stream() // partition は List<A> を 第二引数の数ごと区切ってList<List<A>> にする処理です | |
.flatMap(this::findByIdsInternally) | |
.collect(collctor); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment