Here you can find the source of getSetterFromCache(Class clazz)
public static List<Method> getSetterFromCache(Class clazz)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class Main { private static final Map<Class, List<Method>> setterCache = new ConcurrentHashMap<>(); public static List<Method> getSetterFromCache(Class clazz) { List<Method> methods = setterCache.get(clazz); if (methods == null) { methods = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { String name = method.getName(); if (name.startsWith("set") && method.getParameterTypes().length == 1 && name.length() > 3) { methods.add(method); }//from ww w . j av a 2 s.c o m } setterCache.put(clazz, methods); } return methods; } }