Hey all,

In my application I will need to call various external applications, all in Java. in order to do this, users will be able to customize which aplication and the parameters used to dynamically call it. Therefore the values for creating the dynamic method invocation are stored in a database table.

But i am having a problem - i need to be able to store a Java 'class type' value in a field. By that i mean something like 'String' or 'Object[]' or 'int' (even tho that isnt really an object)

For example, I need to call program xxx.foo.Test and invoke method 'process' which takes a String and an Object[].

in my database I have it designed to store classpath (xxx.foo), class name (Test), method name (process) and then in another table the number of parameters for that method call, broken down by id, index (1, 2, ...), data type (String, Object[], ...) and value (...). But i need to be able to pull out of the database the parameter 'data types' required for the method signature generation.

I am really hoping to avoid having huge 'if-else' statements and storing object type values as integers:

if (obj instanceof String) {
value = new Integer(1);
} else if (obj instanceof Integer) {
value = new Integer(2);
} else if (obj instanceof Long) {
value = new Integer(3);
} else if (obj instanceof Double) {
value = new Integer(4);
} else if (...) {...}...
and then converting them on the way back out - as this means I have to anticipate all possible object types that might be required..

Does anyone have any ideas of suggestions?

Many thanks!