title: Reflection - determine the method to call & params from a DB value
body: <p>I've developed a simple POS system that gets the list of products &amp; buttons from the DB. The table holding all the buttons provides all the information we need to draw the button (i.e.: size, position, label, colour and which SKU it relates to).</p>
  
  <p>In the original version, all the 'function' buttons have been hard coded (i.e.: numbers 1-9, pay, change price levels, end shift etc) but I want to move to a more customisable design, so that function buttons can also be stored in the database.</p>
  
  <p>I was looking at doing this with something reflection based. I have a class to act as an interface, containing all the methods that will appear in the DB, which will then call on any of the necessary methods within the system. But I'm not sure how to map this to the DB.</p>
  
  <p>I'm pretty certain that every method will take 0, 1 or 2 parameters which have a mixture of boolean, int, double and char.</p>
  
  <p>I've come up with a notation for the DB that I can parse to determine all the information I need to call the method, for example to pay off a sale I would put something like</p>
  
  <pre><code>paySale[]
  </code></pre>
  
  <p>in the database, but if the customer gave me a $50 and I wanted to use a 'quick cash' button, then the method call would be</p>
  
  <pre><code>paySale[d 50]
  </code></pre>
  
  <p>or something a little more complex, like paying with a cheque</p>
  
  <pre><code>paySale[i 3, d 50]
  </code></pre>
  
  <p>where the int is the payment method type (in this case would be cheque) and double is the total.</p>
  
  <p>My issue is that when I try to fetch the method using getMethod() I can't figure out how to define which parameters to look for, such as double.class and int.class</p>
  
  <p>There will be several different methods that will need to be called, to handle things like price level changes, end of shift, paying to accounts / tabs etc so if there is an easier way to do this, then I'm open to it!</p>
  
  <p>Thanks again guys!</p>