Bean Bag
Component Containers allow users to discover and execute methods that process strings.
Selecting Open from the File menu displays a file chooser dialog. The dialog should display .class files located in the working directory (unlike mine does):
After selecting a class file, the declared methods of that file are displayed in the method list box. When the user types a sequence of strings in the Args field then selects a method that takes strings as inputs, the Component Container instantiates the class, then invokes the selected method on the specified arguments. The return value is displayed in the Return field.
Exceptions thrown are displayed in the error field:
You will find two files called Test1.class and Test2.class. You should show screen shots of the result of invoking the methods in these classes. Of course your program should not be hardwired to work with only these classes.
BeanBag requires all method parameter and return types to be String. For a little bit of extra credit (25%) relax this condition so that return types can be arbitrary and parameter types can be any parsable type.
All primitive types (int, float, boolean, etc) are parsable.
String is a parsable type
Any class with a constructor with a single String parameter is parsable.
Any class with a parse method is parsable. A parse method is a static method with a single String parameter and having a name with "parse" as its prefix. This method must return an instance of the class.
Hint: Consider using the class java.lang.reflect.Constructor. Also check out Class.isPrimitive().