Here you can find the source of getGetterFieldName(Method method)
public static String getGetterFieldName(Method method)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012-2017 Codenvy, S.A. * 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:/*from www .j a v a 2 s .c om*/ * Codenvy, S.A. - initial API and implementation *******************************************************************************/ import java.lang.reflect.Method; public class Main { /** * Extract field name from the getter method */ public static String getGetterFieldName(Method method) { String methodName = method.getName(); if (methodName.startsWith("get")) { return getFieldName(methodName.substring(3)); } else if (methodName.startsWith("is")) { return getFieldName(methodName.substring(2)); } throw new IllegalArgumentException("Invalid getter method" + method.getName()); } /** * Compute field name from the stringified string type */ public static String getFieldName(String type) { char[] c = type.toCharArray(); c[0] = Character.toLowerCase(c[0]); return new String(c); } }