Java tutorial
//package com.java2s; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; public class Main { public static boolean isAbstract(Element d) { Collection<Modifier> mods = d.getModifiers(); return mods.contains(Modifier.ABSTRACT); } public static String getModifiers(Element d, Modifier ignore) { Collection<Modifier> mods = d.getModifiers(); if (mods.size() == 0) return ""; StringBuilder sbuf = new StringBuilder(mods.size() * 20); for (Modifier mod : mods) { if (!mod.equals(ignore)) sbuf.append(mod); sbuf.append(' '); } sbuf.setLength(sbuf.length() - 1); return sbuf.toString(); } }