Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Locale; import android.util.Log; public class Main { private static Method getBooleanColumnSetMethod(Class<?> entityType, Field field, Class<?> typeClass, String suffix) { String fieldName = field.getName(); String methodName = null; if (isStartWithIs(field.getName())) { methodName = "set" + fieldName.substring(2, 3).toUpperCase(Locale.getDefault()) + fieldName.substring(3) + suffix; } else { methodName = "set" + fieldName.substring(0, 1).toUpperCase(Locale.getDefault()) + fieldName.substring(1) + suffix; } try { return entityType.getDeclaredMethod(methodName, typeClass); } catch (NoSuchMethodException e) { Log.d("L", methodName + " not exist"); } return null; } private static boolean isStartWithIs(final String fieldName) { return fieldName != null && fieldName.startsWith("is"); } }