Skip to content

Commit 70c9a0d

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 8c07f66 commit 70c9a0d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/asciidoc/repositories.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,16 +657,23 @@ class Products implements Streamable<Product> { <2>
657657
.map(Priced::getPrice)
658658
.reduce(Money.of(0), MonetaryAmount::add);
659659
}
660+
661+
662+
@Override public Iterator<Product> iterator() { // <4>
663+
return streamable.iterator();
664+
}
660665
}
661666
662667
interface ProductRepository implements Repository<Product, Long> {
663-
Products findAllByDescriptionContaining(String text); <4>
668+
Products findAllByDescriptionContaining(String text); <5>
664669
}
665670
----
666671
<1> A `Product` entity that exposes API to access the product's price.
667672
<2> A wrapper type for a `Streamable<Product>` that can be constructed by using `Products.of(…)` (factory method created with the Lombok annotation).
673+
A standard constructor taking the `Streamable<Product>` will do as well.
668674
<3> The wrapper type exposes an additional API, calculating new values on the `Streamable<Product>`.
669-
<4> That wrapper type can be used as a query method return type directly.
675+
<4> Implement the `Streamable` interface and delegate to the actual result.
676+
<5> That wrapper type can be used as a query method return type directly.
670677
You need not return `Streamable<Product>` and manually wrap it in the repository client.
671678
====
672679

0 commit comments

Comments
 (0)