A normal form of what I am trying is this.

```
MyClassFacadeLocal cls = new MyClassFacadeLocal();
List allMyClass = cls.findAll();
Iterator it = allMyClass.iterator();
while(it.haxNext()) {
    MyClass Obj = (MyClass)it.next();
    out.println(obj.getTitle());
}

```

Now, the problem I am creating a global method, which can handle several cases of this. For this, I will pass the Entity Class name, method name and the List that is return by the `.findAll()` method. How to solve this using the reflection. What I tried was really rough and of course didn't work.

```
List allMyClass; //I will have passed this before
Iterator it = allMyClass.iterator();
while(it.hasNext()) {

    try {
        Class<?> c = Class.forName(this.getEntityClassName());
        c.cast(it.next());
        Method method = c.getDeclaredMethod("getTitle");
        String title = method.invoke(c, null).toString();
    } catch(Exception e) {
    }

}

```

Gives: `"object is not an instance of declaring class"` error. But I am confident this is a usage flaw.