Using User input for the reflection process in java
<p>basically am trying to make java command prompt. Suppose user enters as input from the user:</p>

<pre><code>new x java.util.ArrayList
</code></pre>

<p>here x is the object name and java.util.ArrayList is the class. So this script inputed by the user means create an object of class java.util.ArrayList.</p>

<p>Now suppose that user enter:</p>

<pre><code>new x java.util.ArrayList int:5 
</code></pre>

<p>means create an object x of the java.util.ArrayList and make its size 5. Like this i want that everytime i input something related to object creation as input i should be able to create class its object and its method based on the input that the user does. Am new to java and reflection so kindly help! here is the code i thought so far using my mind: </p>

<pre><code> public static void token_classification() throws ClassNotFoundException
    {
        my_hash = new HashMap();
        Keep_Obj_Info = new HashMap();
        if(expression_keeper[0].equalsIgnoreCase("new"))
        {
           my_hash.put("Object", expression_keeper[1]);
           Class Obj= Class.forName(expression_keeper[2]);
           Keep_Obj_Info.put("Modifier", Obj.getModifiers());
           Keep_Obj_Info.put("Package",Obj.getPackage());
                ////????


           Constructor[] constructors = Obj.getConstructors();

        }
        else
        if(expression_keeper[0].equalsIgnoreCase("call"))
        {

        }
        else
        if(expression_keeper[0].equalsIgnoreCase("print"))
        {

        }
        else
        {
           System.out.println("Invalid Script!");
        }
    }
</code></pre>

<p>ExpressionKeeper is basically a String array that keeps the user input in tokenized form. Meaning anything next to a white space to a new location.</p>
