Example usage for java.lang.reflect Executable getModifiers

List of usage examples for java.lang.reflect Executable getModifiers

Introduction

In this page you can find the example usage for java.lang.reflect Executable getModifiers.

Prototype

public abstract int getModifiers();

Source Link

Document

Returns the Java language Modifier modifiers for the executable represented by this object.

Usage

From source file:MyClass.java

public static String getModifiers(Executable exec) {
    int mod = exec.getModifiers();
    if (exec instanceof Method) {
        mod = mod & Modifier.methodModifiers();
    } else if (exec instanceof Constructor) {
        mod = mod & Modifier.constructorModifiers();
    }//  w ww. j  a  v  a2  s .co  m
    return Modifier.toString(mod);
}