enter image description here

On the hands there is such a UML. It is not clear how to make an abstract class AbstractProcess and what the methods are stepBefore (), stepAfter (), there is no more information.

  • From the rest, is anything clear / implemented? If there is a code, then it is better to ask questions about it. - default locale

1 answer 1

It looks like it should look like this:

Ordable.java

public interface Orderable { boolean checkout(); boolean pay(); } 

AbstractProcess.java

 public abstract class AbstractProcess { public void process(Orderable item) { throw new UnsupportedOperationException("Method not implemented"); } public void stepBefore() { throw new UnsupportedOperationException("Method not implemented"); } public void stepAfter() { throw new UnsupportedOperationException("Method not implemented"); } public abstract void action(Orderable item); } 

CheckoutProcess.java

 public class CheckoutProcess extends AbstractProcess { @Override public void action(Orderable item) { throw new UnsupportedOperationException("Method not implemented"); } } 

PaymentProcess.java

 public class PaymentProcess extends AbstractProcess { @Override public void action(Orderable item) { throw new UnsupportedOperationException("Method not implemented"); } } 

Order.java

 public class Order implements Orderable { private int id; private String status; public String getStatus() { throw new UnsupportedOperationException("Method not implemented"); } @Override public boolean checkout() { return false; } @Override public boolean pay() { return false; } } 

This is only a skeleton, built on the diagram. All methods should be implemented explicitly depending on your goals. I hope this will help move on.