title: Maintain different version of java method under feature flag
body: <p>Considering the follow method in SomeService.class</p>
  
  <pre><code>List&lt;SomeObject&gt; getSomeObjectDetails(String s){
      someRepo.get(s);
  }
  </code></pre>
  
  <p>Now let's say I want to have a feature flag that I can turn off or on, and depending of it's value it will perform a different operation. The way I found to do this is with a simple if</p>
  
  <pre><code>List&lt;SomeObject&gt; getSomeObjectDetails(String s){
      if(someFeatureFlag == false){
        someRepo.get(s);
      } else {
        newRepo.get(s);
      }
  }
  </code></pre>
  
  <p>I find this code appalling and the idea of maintaining different code versions using a feature flag disturbing.
  Is there a better way for this method only to follow the correct code path based on a feature flag?</p>