VisitorのうちTypeDeclaration? を引数に取る
public boolean visit(TypeDeclaration node);
はクラスのいろいろな情報がとれそうです。
package nu.mine.kino; public interface IBL { void exe(); String exe(String hoge); }
package nu.mine.kino; import java.io.Serializable; public class BL implements IBL, Serializable { private final String field; public BL() { System.out.println("Constructor"); field = ""; } public BL(String field) { System.out.println("Constructor"); this.field = field; } public void exe() { System.out.println("hoge"); } public String exe(String hoge) { System.out.println(hoge); return hoge; } }
上のBLに対して
List interfaces = node.superInterfaceTypes();
を実行するとorg.eclipse.jdt.core.dom.SimpleType?のListが取得できます。このSimpleType?に対して、
SimpleType#getName();
とすることで実装しているインタフェース名が取得できます。
この記事は
現在のアクセス:10000