find valid class and class method

hi,

given a string "com.test.reflect.Test" .

i need to validate whether Class "Test " present in a given string"com.test.reflect.Test"

if com.test.reflect.Tes is given string then it should through an exception as Tes class is not present.

given a string "com.test.reflect.Test.getTestMethod" .

i need to validate whether Class "Test " present in a given string"com.test.reflect.Test.getTestMethod"

if com.test.reflect.Test.getMd is given string then it should through an exception as getMd method is not present.

help is needly appriciated

Thanks

Sachin

[624 byte] By [sachin@a] at [2007-11-27 6:36:41]
# 1

String className = "com.test.reflect.Test";

try {

Class.forName(className);

} catch (ClassNotFoundException e) {

// deal with the fact that class does not exist here

}

Method finding? You can work that out for yourself if you know about the methods Class.getMethods() and Class.getDeclaredMethods(), and know how to split a string up

georgemca at 2007-7-12 18:04:38 > top of Java-index,Java Essentials,Java Programming...