Package org.salespointframework.order
Class OrderCompletionReport
java.lang.Object
org.salespointframework.order.OrderCompletionReport
- All Implemented Interfaces:
Iterable<OrderCompletionReport.OrderLineCompletion>
,Supplier<Stream<OrderCompletionReport.OrderLineCompletion>>
,Streamable<OrderCompletionReport.OrderLineCompletion>
public class OrderCompletionReport
extends Object
implements Streamable<OrderCompletionReport.OrderLineCompletion>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The status of a completion.static final class
The completion status of anOrderLine
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
static OrderCompletionReport
Creates anOrderCompletionReport
for anOrder
that's marked as failed.static OrderCompletionReport
forCompletions
(Order order, Iterable<OrderCompletionReport.OrderLineCompletion> completions) Creates a newOrderCompletionReport
for the givenOrder
andOrderCompletionReport.OrderLineCompletion
s.@NonNull Order
getOrder()
boolean
Returns whether there report contains any errors.int
hashCode()
iterator()
onError
(Function<OrderCompletionReport, ? extends RuntimeException> exception) Applies the givenFunction
to produce an exception in case the report has errors.static OrderCompletionReport
Creates anOrderCompletionReport
representing a successful verification of the givenOrder
.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
success
Creates anOrderCompletionReport
representing a successful verification of the givenOrder
.- Parameters:
order
- must not be null.- Returns:
- will never be null.
-
failed
Creates anOrderCompletionReport
for anOrder
that's marked as failed.- Parameters:
order
- must not be null.- Returns:
- will never be null.
-
forCompletions
public static OrderCompletionReport forCompletions(Order order, Iterable<OrderCompletionReport.OrderLineCompletion> completions) Creates a newOrderCompletionReport
for the givenOrder
andOrderCompletionReport.OrderLineCompletion
s.- Parameters:
order
- must not be null.completions
- must not be null.- Returns:
- will never be null.
-
hasErrors
public boolean hasErrors()Returns whether there report contains any errors. If true, clients should go ahead and inspect the report forOrderCompletionReport.OrderLineCompletion
(e.g. usingStreamable.stream()
to access the individual completions).- Returns:
-
onError
public OrderCompletionReport onError(Function<OrderCompletionReport, ? extends RuntimeException> exception) Applies the givenFunction
to produce an exception in case the report has errors.- Parameters:
exception
- must not be null.- Since:
- 7.1
-
iterator
- Specified by:
iterator
in interfaceIterable<OrderCompletionReport.OrderLineCompletion>
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getOrder
-
getStatus
-