Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;

public class Main {

    @SuppressWarnings("unchecked")
    public static Method getGetMethod(Class objectClass, String fieldName) {

        StringBuffer sb = new StringBuffer();

        sb.append("get");

        sb.append(fieldName.substring(0, 1).toUpperCase());

        sb.append(fieldName.substring(1));

        try {

            return objectClass.getMethod(sb.toString());

        } catch (Exception e) {

        }

        return null;

    }
}