Here you can find the source of getGetterName(Method m)
Parameter | Description |
---|---|
m | Method object. |
private static String getGetterName(Method m)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { /**/*from w w w . jav a2 s . c om*/ * Get getter name. "getName" -> "name", "isMale" -> "male". * * @param m Method object. * @return Property name of this getter. */ private static String getGetterName(Method m) { String name = m.getName(); if (name.startsWith("get") && (name.length() >= 4) && !m.getReturnType().equals(void.class) && (m.getParameterTypes().length == 0)) { return Character.toLowerCase(name.charAt(3)) + name.substring(4); } if (name.startsWith("is") && (name.length() >= 3) && (m.getReturnType().equals(boolean.class) || m.getReturnType().equals(Boolean.class)) && (m.getParameterTypes().length == 0)) { return Character.toLowerCase(name.charAt(2)) + name.substring(3); } return null; } }