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
Nested ClassesModifier and TypeClassDescriptionstatic enumThe status of a completion.static final classThe completion status of anOrderLine. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanstatic OrderCompletionReportCreates anOrderCompletionReportfor anOrderthat's marked as failed.static OrderCompletionReportforCompletions(Order order, Iterable<OrderCompletionReport.OrderLineCompletion> completions) Creates a newOrderCompletionReportfor the givenOrderandOrderCompletionReport.OrderLineCompletions.@NonNull OrdergetOrder()booleanReturns whether there report contains any errors.inthashCode()iterator()onError(Function<OrderCompletionReport, ? extends RuntimeException> exception) Applies the givenFunctionto produce an exception in case the report has errors.static OrderCompletionReportCreates anOrderCompletionReportrepresenting a successful verification of the givenOrder.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
success
Creates anOrderCompletionReportrepresenting a successful verification of the givenOrder.- Parameters:
order- must not be null.- Returns:
- will never be null.
-
failed
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 OrderCompletionReport 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
- Specified by:
iteratorin interfaceIterable<OrderCompletionReport.OrderLineCompletion>
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getOrder
-
getStatus
-