Here you can find the source of getMethodPropertyName(java.lang.reflect.Method method)
private static String getMethodPropertyName(java.lang.reflect.Method method)
//package com.java2s; /*/*from w ww . j a va 2s . c om*/ * #%L * dbtool-orm * %% * Copyright (C) 2015 Kwanza * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ public class Main { private static String getMethodPropertyName(java.lang.reflect.Method method) { final String methodName = method.getName(); if (methodName.startsWith("get") && methodName.length() > 3) { return uncapitalize(methodName.substring(3, methodName.length())); } else { throw new RuntimeException("Incorrect getter name: " + methodName); } } private static String uncapitalize(String str) { return changeFirstCharacterCase(str, false); } private static String changeFirstCharacterCase(String stringValue, boolean capitalize) { final StringBuilder stringBuilder = new StringBuilder(stringValue.length()); if (capitalize) { stringBuilder.append(Character.toUpperCase(stringValue.charAt(0))); } else { stringBuilder.append(Character.toLowerCase(stringValue.charAt(0))); } stringBuilder.append(stringValue.substring(1)); return stringBuilder.toString(); } }