ご覧のとおり、私は3種類の注釈クラスを持っています。クラス名以外の3つはすべて同じです。 Tree.getAnnotations()
を呼び出すと表示されるのは、@Element
の注釈だけです。注釈が1つだけ表示されています
@Element(name = "node")
public class Tree<T> {
private Tree<T>[] children = null;
private T value;
public Tree(T v, Tree<T>[] trees){
children = trees;
value = v;
}
public Tree(T v){
value = v;
}
@SubElements(name = "subnodes")
public Tree<T>[] getChildren(){
return children;
}
@ElementField(name = "value")
public T getValue(){
return value;
}
}
これは、アノテーションクラスです:
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Element {
String name();
}
スクリーンショットをリンクしないでコードを直接投稿してください –
申し訳ありませんが、私はそれを行う方法がわかりません –
@AntonGustafsson Copy + Paste? – assylias