You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
756 B
32 lines
756 B
package 依赖关系;
|
|
|
|
|
|
/**
|
|
* @author The Administrator
|
|
* @version 1.0
|
|
* @created 26-10月-2025 20:04:34
|
|
*/
|
|
public class OrderProcessor {
|
|
|
|
private final OrderValidator validator;
|
|
private final OrderNotifier notifier;
|
|
|
|
public OrderProcessor(OrderValidator validator, OrderNotifier notifier) {
|
|
this.validator = validator;
|
|
this.notifier = notifier;
|
|
}
|
|
|
|
public void processOrder() {
|
|
System.out.println("Processing order...");
|
|
if (!validateOrder()) {
|
|
System.out.println("Order validation failed.");
|
|
return;
|
|
}
|
|
System.out.println("Order processed.");
|
|
notifier.sendNotification("Order processed successfully.");
|
|
}
|
|
|
|
public boolean validateOrder() {
|
|
return validator.validate();
|
|
}
|
|
}//end OrderProcessor
|