Skip to content

Instantly share code, notes, and snippets.

@asunwoo
Created October 31, 2017 19:47
Show Gist options
  • Select an option

  • Save asunwoo/674f877549e1e30383aa6f9ce7ff0cc6 to your computer and use it in GitHub Desktop.

Select an option

Save asunwoo/674f877549e1e30383aa6f9ce7ff0cc6 to your computer and use it in GitHub Desktop.
public ProductSort getExperimentImpl(String experimentName, String userId){
Variation variation = this.optimizelyClient.activate(experimentName, userId);
ProductSort retobj = null;
if(variation.getKey().equals("PriceProductSort")){
retobj = new CategoryProductSort();
} else if(variation.getKey().equals("NameProductSort")){
retobj = new NameProductSort();
} else if(variation.getKey().equals("CategoryProductSort")){
retobj = new PriceProductSort();
} else{
//Defaulting to price sorting
retobj = new PriceProductSort();
}
return retobj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment