title: Best practice to translate hard coded strings
body: <p>I have a finite set of strings for a product name. I also have a web service which sends one of these product names. However I need to send the product name in another format. </p>
  
  <p>So I need a formatter/mapper somewhere before I send the message.</p>
  
  <p>I COULD just make some hardcoded mapper class which takes in an argument and returns a hardcoded string like this:</p>
  
  <pre><code>String mapper(String productName) {
      switch (productName) {
      case "product1":
          return "prod1";
      case "product2":
          return "prod2"
  }
  </code></pre>
  
  <p>However, I dont really like this approach, but I have a hard time trying to think up a better solution. Anyone have a better solution for this problem?</p>
  
  <p>I'm considering storing the mapping in the database and then create a DAO for this mapping which instead of using a switch it uses the argument as key and then queries the database which returns the alternative product name, but I'm not sure if its really a better solution.</p>
  
  <p>any thoughts?</p>
  
  <p><em><strong></em>*  EDIT <em>*</em></strong></p>
  
  <p>Forgot to mention this:</p>
  
  <p>The original product names are currently stored in the database. I will need to translate these names without modifying the current code/table setup, i.e. I cannot edit the table and current classes, but I can create new tables/classes if needed.</p>