Skip to content

Commit 238523e

Browse files
michael-simonsmp911de
authored andcommitted
DATACMNS-1837 - Add the required override to the example.
The example should be a compilable unit. Original pull request: #475.
1 parent fcbe82d commit 238523e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/asciidoc/repositories.adoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,22 @@ class Products implements Streamable<Product> { <2>
555555
.map(Priced::getPrice)
556556
.reduce(Money.of(0), MonetaryAmount::add);
557557
}
558+
559+
@Override public Iterator<Product> iterator() { // <4>
560+
return streamable.iterator();
561+
}
558562
}
559563
560564
interface ProductRepository implements Repository<Product, Long> {
561-
Products findAllByDescriptionContaining(String text); <4>
565+
Products findAllByDescriptionContaining(String text); <5>
562566
}
563567
----
564568
<1> A `Product` entity that exposes API to access the product's price.
565569
<2> A wrapper type for a `Streamable<Product>` that can be constructed by using `Products.of(…)` (factory method created with the Lombok annotation).
570+
A standard constructor taking the `Streamable<Product>` will do as well.
566571
<3> The wrapper type exposes an additional API, calculating new values on the `Streamable<Product>`.
567-
<4> That wrapper type can be used as a query method return type directly. You need not return `Streamable<Product>` and manually wrap it in the repository client.
572+
<4> Implement the `Streamable` interface and delegate to the actual result.
573+
<5> That wrapper type can be used as a query method return type directly. You need not return `Streamable<Product>` and manually wrap it in the repository client.
568574
====
569575

570576
[[repositories.collections-and-iterables.vavr]]

0 commit comments

Comments
 (0)