Java Reflection Method Setter Get getSetterMethod(Class beanClass, String fieldName, List supportedTypes)

Here you can find the source of getSetterMethod(Class beanClass, String fieldName, List supportedTypes)

Description

get Setter Method

License

Open Source License

Declaration

private static Method getSetterMethod(Class beanClass, String fieldName, List<Class> supportedTypes) 

Method Source Code


//package com.java2s;
/* $This file is distributed under the terms of the license in /doc/license.txt$ */

import java.lang.reflect.Method;

import java.util.List;

public class Main {
    private static Method getSetterMethod(Class beanClass, String fieldName, List<Class> supportedTypes) {
        for (Class clazz : supportedTypes) {
            try {
                Class[] argList = new Class[1];
                argList[0] = clazz;//  w  w w.  j  a v  a 2 s.  c  o  m
                return beanClass.getMethod("set" + fieldName, argList);
            } catch (NoSuchMethodException nsme) {
                // just try the next type
            }
        }
        return null;
    }
}

Related

  1. getSetterAttributeType(Method m)
  2. getSetterFieldName(Method method)
  3. getSetterForGetter(Method[] methods, Method getter)
  4. getSetterFromCache(Class clazz)
  5. getSetterMap(Class cls)
  6. getSetterMethod(Class c, String methodName)
  7. getSetterMethod(Class containingClass, Class propertyType, String propertyName)
  8. getSetterMethod(Class type, String property)
  9. getSetterMethod(Class beanClass, String property)