Java examples for Reflection:Setter
get Setter Method Name
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String property = "java2s.com"; System.out.println(getSetterMethodName(property)); }//from w w w. j av a 2s . c o m public static String getSetterMethodName(String property) { StringBuilder sb = new StringBuilder(); sb.append(property); if (Character.isLowerCase(sb.charAt(0))) { if (sb.length() == 1 || !Character.isUpperCase(sb.charAt(1))) { sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); } } sb.insert(0, "set"); return sb.toString(); } }