Skip to content

Instantly share code, notes, and snippets.

@alex-ber
Last active July 24, 2021 18:48
Show Gist options
  • Select an option

  • Save alex-ber/435ca6207302c5cf2ed5eebb75e99425 to your computer and use it in GitHub Desktop.

Select an option

Save alex-ber/435ca6207302c5cf2ed5eebb75e99425 to your computer and use it in GitHub Desktop.
import java.util.Objects;
public class Pizza implements Delivarable {
private DelivarableStatus status = DelivarableStatus.IN_PROGRESS;
private PizzaDeliveryStrategy strategy;
public Pizza(PizzaDeliveryStrategy strategy){
this.strategy = Objects.requireNotNull(strategy);
}
public void getStatus(DelivarableStatus status){
return this.status;
}
public void setStatus(DelivarableStatus status){
this.status = status;
}
@Override
public void deliver(){
if (isDeliverable()) {
this.strategy.deliver(this);
this.setStatus(DelivarableStatus.DELIVERED);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment