Package org.salespointframework.order
Class OrderCompletionReport
- java.lang.Object
-
- org.salespointframework.order.OrderCompletionReport
-
- All Implemented Interfaces:
Iterable<OrderCompletionReport.OrderLineCompletion>,Supplier<Stream<OrderCompletionReport.OrderLineCompletion>>,org.springframework.data.util.Streamable<OrderCompletionReport.OrderLineCompletion>
public class OrderCompletionReport extends Object implements org.springframework.data.util.Streamable<OrderCompletionReport.OrderLineCompletion>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOrderCompletionReport.CompletionStatusThe status of a completion.static classOrderCompletionReport.OrderLineCompletionThe completion status of anOrderLine.
-
Method Summary
-
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 Detail
-
success
public static OrderCompletionReport success(Order order)
Creates anOrderCompletionReportrepresenting a successful verification of the givenOrder.- Parameters:
order- must not be null.- Returns:
- will never be null.
-
failed
public static OrderCompletionReport failed(Order order)
Creates anOrderCompletionReportfor anOrderthat'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 newOrderCompletionReportfor the givenOrderandOrderCompletionReport.OrderLineCompletions.- 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 void onError(Function<OrderCompletionReport,? extends RuntimeException> exception)
Applies the givenFunctionto produce an exception in case the report has errors.- Parameters:
exception- must not be null.- Since:
- 7.1
-
iterator
public Iterator<OrderCompletionReport.OrderLineCompletion> iterator()
- Specified by:
iteratorin interfaceIterable<OrderCompletionReport.OrderLineCompletion>
-
canEqual
protected boolean canEqual(Object other)
-
getOrder
@NonNull public @NonNull Order getOrder()
-
getStatus
@NonNull public @NonNull OrderCompletionReport.CompletionStatus getStatus()
-
-