Java examples for Reflection:Java Bean
Returns the name of the property setter in the bean.
//package com.java2s; public class Main { /**/*from w w w. j a va2s .co m*/ * Returns the name of the property setter in the bean. * * @param name * Name of the property. * * @return The name of the property setter. */ public static String getPropertySetterName(String name) { if (name == null) { throw new NullPointerException("Property name cannot be null"); } name = name.trim(); if ("".equals(name)) { throw new IllegalArgumentException( "Property name cannot be empty"); } final String name1 = name.substring(0, 1).toUpperCase() + name.substring(1); return "set" + name1; } }