{{theTime}}

Search This Blog

Total Pageviews

Java Reflection Example to Find Methods in a Class.

import static java.lang.System.err;

import java.lang.reflect.Method; 

public class FindPublicMethodsInAClass
{

    public static void main(String ...vars) {

       if (vars.length <= 0) {
            err.format("Enter Class name") ;
            return ;
        }       
        try{
            Class<?> inputclass = Class.forName(vars[0]) ;
            Object obj = inputclass.newInstance() ;         
            Method[] methods = ((Class<?>) obj).getDeclaredMethods() ;
            for ( Method method : methods) {
                System.out.println("Method Name: " + method.getName());
            }
        }catch(ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

No comments:

Kafka Consumer Parallelism

Kafka Parallel Consumer Options: Key-level parallelism:  Multiple threads process the messages from a single partition in parallel while ma...