Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;
import java.util.HashMap;

import java.util.Map;

public class Main {

    private static void methodInvoker(Object receiver, String methodName, HashMap<String, Object> map) {
        for (Class<?> klass = receiver.getClass(); !(Object.class.equals(klass)); klass = klass.getSuperclass()) {
            try {
                Method method = klass.getDeclaredMethod(methodName, Map.class);
                method.setAccessible(true);
                method.invoke(receiver, map);
                break;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}