DATACMNS-1837 - Polishing.
Consistent callout indentation. Tweak wording. Original pull request: #475.
This commit is contained in:
@@ -643,23 +643,24 @@ The following listing shows an example:
|
||||
====
|
||||
[source,java]
|
||||
----
|
||||
class Product { <1>
|
||||
class Product { <1>
|
||||
MonetaryAmount getPrice() { … }
|
||||
}
|
||||
|
||||
@RequiredArgConstructor(staticName = "of")
|
||||
class Products implements Streamable<Product> { <2>
|
||||
class Products implements Streamable<Product> { <2>
|
||||
|
||||
private Streamable<Product> streamable;
|
||||
|
||||
public MonetaryAmount getTotal() { <3>
|
||||
return streamable.stream() //
|
||||
public MonetaryAmount getTotal() { <3>
|
||||
return streamable.stream()
|
||||
.map(Priced::getPrice)
|
||||
.reduce(Money.of(0), MonetaryAmount::add);
|
||||
}
|
||||
|
||||
|
||||
@Override public Iterator<Product> iterator() { // <4>
|
||||
@Override
|
||||
public Iterator<Product> iterator() { <4>
|
||||
return streamable.iterator();
|
||||
}
|
||||
}
|
||||
@@ -673,8 +674,8 @@ interface ProductRepository implements Repository<Product, Long> {
|
||||
A standard constructor taking the `Streamable<Product>` will do as well.
|
||||
<3> The wrapper type exposes an additional API, calculating new values on the `Streamable<Product>`.
|
||||
<4> Implement the `Streamable` interface and delegate to the actual result.
|
||||
<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.
|
||||
<5> That wrapper type `Products` can be used directly as a query method return type.
|
||||
You do not need to return `Streamable<Product>` and manually wrap it after the query in the repository client.
|
||||
====
|
||||
|
||||
[[repositories.collections-and-iterables.vavr]]
|
||||
|
||||
Reference in New Issue
Block a user