我有一些Java中方法的類如下:如何在java中獲得特殊的類方法?
public class Class1
{
private String a;
private String b;
public setA(String a_){
this.a = a_;
}
public setb(String b_){
this.b = b_;
}
public String getA(){
return a;
}
@JsonIgnore
public String getb(){
return b;
}
}
我想在Class1
,它使用的是不與@JsonIgnore
註解來聲明字符串get
開始的所有方法。
我該怎麼做?
你會從中得到一些想法:http://stackoverflow.com/questions/6593597/java-seek-a-method-with-specific-annotation-and-its-annotation-element – RahulArackal
我m猜你正在嘗試將java類轉換爲json。試試這個庫http://flexjson.sourceforge.net/。它處理多個級別,自定義轉換和包含/排除路徑。 – Goose