// 下階層用テンプレート
#topicpath
----
//ここにコンテンツを記述します。
VisitorのうちTypeDeclaration を引数に取る
 public boolean visit(TypeDeclaration node);
はクラスのいろいろな情報がとれそうです。


**対象のクラス [#n229a531]
-nu.mine.kino.IBL インタフェース
 package nu.mine.kino;
 
 public interface IBL {
   void exe();
   String exe(String hoge);
 }


-nu.mine.kino.BL クラス
 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;
   }
 }

**いろいろ試してみる [#gba5f11f]
***実装しているインタフェースを取得する [#n3933319]
上のBLに対して
 List interfaces = node.superInterfaceTypes();
を実行するとorg.eclipse.jdt.core.dom.SimpleTypeのListが取得できます。このSimpleTypeに対して、
 SimpleType#getName();
とすることで実装しているインタフェース名が取得できます。

----
この記事は
#vote(おもしろかった,そうでもない)

#comment
#topicpath


SIZE(10){現在のアクセス:&counter;}

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS