Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-present Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Stuart McCulloch (Sonatype, Inc.) - initial API and implementation
 *******************************************************************************/

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;

public class Main {
    private static Method findMethod(final Class<?> beanType, final Type[] paramTypeHolder,
            final String methodName) {
        for (final Method m : beanType.getMethods()) {
            if (methodName.equals(m.getName()) && !Modifier.isStatic(m.getModifiers())) {
                final Type[] paramTypes = m.getGenericParameterTypes();
                if (paramTypes.length == 1) {
                    paramTypeHolder[0] = paramTypes[0];
                    return m;
                }
            }
        }
        return null;
    }
}