is Setter Method - Android java.lang.reflect

Android examples for java.lang.reflect:Method Getter Setter

Description

is Setter Method

Demo Code


//package com.java2s;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Main {
    static boolean isSetter(Method method) {
        return method != null && method.getName().startsWith("set")
                && method.getName().length() > 3
                && method.getReturnType() == void.class
                && method.getParameterTypes().length == 1
                && !Modifier.isStatic(method.getModifiers())
                && Modifier.isPublic(method.getModifiers());
    }/*from   w  w  w  .  j av  a  2  s.  c o  m*/
}

Related Tutorials