title: Java. Runtime compile method with different types and numbers of parameters
body: <p>I create web application where user can input Java source code in input area, then send it to server, compile it in runtime and test it. But I don't know, how create file for compilation and how keep signature of methods (sequence and types of parameters).</p>
  
  <p><strong>For example, I have method such as:</strong></p>
  
  <pre><code>public Integer sum(Integer first, Integer second){
      return first + second;
  }
  </code></pre>
  
  <p>But how I can keep this signature of method in database and create file which should be compile? 
  Now I am creating method which get a testing input value (in this case: 1, 5 [Integer, Integer]) and then create Scanner of input and read values such as scanner.nextInt(), add it in List of object etc and in the end run method such as sum((Integer)list.get(0), (Integer)list.get(1)).</p>
  
  <p><strong>That if other types of data and a different number of input parameters of the method?</strong></p>
  
  <pre><code>Scanner sc = new Scanner(input);
  List list = new ArrayList();
  while(sc.hasNextInt()){
      Integer value = scanner.nextInt();
      list.add(value);
  }
  int sumResult = sum((Integer)list.get(0), (Integer)list.get(1));
  </code></pre>
  
  <p>Any ideas? Thanks.</p>