is Mutator Method - Java Reflection

Java examples for Reflection:Method

Description

is Mutator Method

Demo Code


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

public class Main {
    public static final String[] MUTATOR_PREFIXES = new String[] { "set" };

    public static boolean isMutator(Method method) {
        for (String prefix : MUTATOR_PREFIXES) {
            if (method.getName().startsWith(prefix))
                return true;
        }/*from w  w  w  .j a va  2s  . c  o m*/
        return false;
    }
}

Related Tutorials