Hi,
I have a while loop, and the user should be able to decide when the loop stops. After x seconds, after x loops, ... This problem should be implemented according to policy-based design. I know how to do this in C++ but can't get it to work in Java.
What I do now is the following.
There is a class Auctioneer with the method "start()" where the policies should be applicable:
public <E extends AbstractEndAuctionPolicy> void start(E policy) { //use policy here }
Because AbstractEndAuctionPolicy has the method "endAuction()", we are able to do: policy.endAuction(). In C++ there is no need for "extends AbstractEndAuctionPolicy" ...
But I can not figure out how to use this method, the following is not working:
this.auctioneer.start<NewBidPolicy>(n);
Hope you guys can help me and inform me a bit about policy-based design in Java because Google is not giving me answers.
Thanks in advance.