Example usage for java.lang.reflect Modifier parameterModifiers

List of usage examples for java.lang.reflect Modifier parameterModifiers

Introduction

In this page you can find the example usage for java.lang.reflect Modifier parameterModifiers.

Prototype

public static int parameterModifiers() 

Source Link

Document

Return an int value OR-ing together the source language modifiers that can be applied to a parameter.

Usage

From source file:MyClass.java

public static ArrayList<String> getParameters(Executable exec) {
    Parameter[] parms = exec.getParameters();
    ArrayList<String> parmList = new ArrayList<>();
    for (int i = 0; i < parms.length; i++) {

        int mod = parms[i].getModifiers() & Modifier.parameterModifiers();
        String modifiers = Modifier.toString(mod);
        String parmType = parms[i].getType().getSimpleName();
        String parmName = parms[i].getName();
        String temp = modifiers + "  " + parmType + "  " + parmName;
        if (temp.trim().length() == 0) {
            continue;
        }// w  w w .ja  v a  2  s  . co  m
        parmList.add(temp.trim());
    }
    return parmList;
}