Here you can find the source of getSetterFieldName(Method method)
public static String getSetterFieldName(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 ww w.j ava2 s.c o m*/ * Codenvy, S.A. - initial API and implementation *******************************************************************************/ import java.lang.reflect.Method; public class Main { /** * Extract field name from the setter method */ public static String getSetterFieldName(Method method) { String methodName = method.getName(); if (methodName.startsWith("set")) { return getFieldName(methodName.substring(3)); } throw new IllegalArgumentException("Invalid setter 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); } }