获得修饰语等级
//package com.nowjava; /* *来 自 n o w j a v a . c o m */ import java.util.Set; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; public class Main { static final int PRIVATE = -1; static final int DEFAULT = 0; static final int PROTECTED = 1; static final int PUBLIC = 2; static int getModifierLevel(Element element) { Set<Modifier> modifiers = element.getModifiers(); if (modifiers.contains(Modifier.PUBLIC)) { return PUBLIC; /* *来 自 n o w j a v a . c o m - 时 代 Java */ } if (modifiers.contains(Modifier.PROTECTED)) {