Java tutorial
//package com.java2s; import javax.lang.model.element.ExecutableElement; import javax.lang.model.type.TypeMirror; public class Main { public static String getThrows(ExecutableElement d) { Collection<? extends TypeMirror> params = d.getThrownTypes(); if (params.size() == 0) return ""; StringBuilder sbuf = new StringBuilder(params.size() * 20); sbuf.append("throws "); for (TypeMirror param : params) { sbuf.append(param.toString()); sbuf.append(','); } sbuf.setLength(sbuf.length() - 1); return sbuf.toString(); } }