mardi 2 mai 2017

Only one annotation is showing

As you can see I have 3 different annotation classes. All 3 are identical except the name of the class. The only one showing up when I call for Tree.getAnnotations() is the annotation @Element.

    @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;
    }

}

This is the annotation class:

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface Element {

    String name();

}





Aucun commentaire:

Enregistrer un commentaire