Java Reflection Method Setter Get getSetter(final Class clz, final String propertyName, final Class propertyClass)

Here you can find the source of getSetter(final Class clz, final String propertyName, final Class propertyClass)

Description

get Setter

License

Open Source License

Declaration

public static Method getSetter(final Class<?> clz, final String propertyName, final Class<?> propertyClass)
            throws NoSuchMethodException 

Method Source Code


//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Method getSetter(final Class<?> clz, final String propertyName, final Class<?> propertyClass)
            throws NoSuchMethodException {
        final Class<?> setterArgs[] = new Class[1];
        setterArgs[0] = propertyClass;//from w ww. j av a2 s  .  c  o m
        final String setterName = "set" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
        return clz.getMethod(setterName, setterArgs);
    }
}

Related

  1. getSetter(Class clazz, Field field)
  2. getSetter(Class clazz, String property, Class type)
  3. getSetter(Class cls, final String fieldName)
  4. getSetter(final Class targetClass, final String propertyName)
  5. getSetter(final Class clazz, final String fieldName, final Class... fieldClass)
  6. getSetter(final Object o, final String fieldName)
  7. getSetter(Method m)
  8. getSetter(Object instance, String methodName)
  9. getSetter(Object object, String name, Class type)