//解析普通的方法
@test
public void fetchmethods() throws exception
/*獲取泛型
m.getgenericreturntype();//返回型別中的泛型--class
m.getexceptiontypes(); //異常中的泛型--class
m.getgenericparametertypes(); //引數中的泛型 ---class
*/class exs = m.getexceptiontypes();//獲得異常
for(int j=1;j<=exs.length;j++)
int mod = m.getmodifiers();//獲得修飾符
system.out.println("modifiers1:"+mod);
system.out.println("modifiers2:"+ modifier.tostring(mod));
system.out.println("--------------------");}}
//解析工作方法
@test
public void fetchconstructors() throws exception
class exs = con.getexceptiontypes();//獲得異常
for(int j=1;j<=exs.length;j++)
int mod =con.getmodifiers();//獲得修飾符
system.out.println("modifiers1:"+mod);
system.out.println("modifiers2:"+ modifier.tostring(mod));
system.out.println("--------------------");}}
//解剖屬性
@test
public void fetchfields() throws exception
}
類的解剖(獲取類的定義資訊)
獲取類的方法 method 獲取類中的方法的資訊 getmethods 獲取當前類及其父類宣告的public方法 getdeclaremethods 獲取當前類宣告的所有方法,包括private和public 獲取類的構造方法 construct 獲取類中的方法的資訊 getconstructors...
獲取類的物件資訊
首先你有乙個command.py檔案,內容如下,這裡我們假若它後面還有100個方法 class myobject object def init self self.x 9 def add self return self.x self.x def pow self return self.x se...
類映象的使用1 類資訊的獲取
1.獲得該類所處的包的資訊 student s new student class c s.getclass system.out println c.getpackage getname 2.獲得該類的修飾符資訊 每個修飾符對應乙個int值 如果有多個修飾符則int值相加 student s ne...