Here you can find the source of getMethod(Class> type, String name, Class>... parameterTypes)
private static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes)
//package com.java2s; /**/*from ww w . j a va2 s . c o m*/ * Copyright (c) 2013-2016, The SeedStack authors <http://seedstack.org> * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.lang.reflect.Method; import java.util.Optional; public class Main { private static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) { try { return Optional.of(type.getDeclaredMethod(name, parameterTypes)); } catch (NoSuchMethodException e) { return Optional.empty(); } } }