I have a while loop, and the user should be able to decide when the loop will stop. After x seconds, after cycles x, ... This problem should be implemented in accordance with the political design. I know how to do this in C ++, but I can't get it to work in Java.
Now I am doing the following.
There is an Auctioneer class with the "start ()" method where policies should be applied:
public <E extends AbstractEndAuctionPolicy> void start(E policy) { //use policy here }
Since AbstractEndAuctionPolicy has an endAuction () method, we can do: policy.endAuction (). In C ++, there is no need to extend AbstractEndAuctionPolicy ...
But I can not understand how to use this method, the following does not work:
this.auctioneer.start<NewBidPolicy>(n);
I hope you guys can help me and tell me a little about policy development in Java, because Google does not give me answers.
Thanks in advance.