View Javadoc
1   package at.rseiler.spbee.core.pojo;
2   
3   import java.io.Serializable;
4   
5   /**
6    * Holds the information of a annotation parameter.
7    * <p>
8    * The field value can hold other javax.lang.model.element.* classes.
9    * See: at.rseiler.spbee.core.generator.DtoGenerator.DtoClassGeneratorInstance#addAnnotationParam(com.sun.codemodel.JAnnotationUse, AnnotationValueInfo)
10   * and at.rseiler.spbee.core.generator.DtoGenerator.DtoClassGeneratorInstance#addAnnotationArrayMemberParam(com.sun.codemodel.JAnnotationArrayMember, AnnotationValueInfo)
11   * </p>
12   *
13   * @author Reinhard Seiler {@literal <rseiler.developer@gmail.com>}
14   */
15  public class AnnotationValueInfo implements Serializable {
16  
17      private static final long serialVersionUID = 5474410388632197978L;
18  
19      private final String name;
20      private final Object value;
21      private final String type;
22      private final Kind kind;
23  
24      /**
25       * Constructs a new AnnotationValueInfo.
26       *
27       * @param name  the name of the annotation parameter
28       * @param value the value of the annotation parameter
29       * @param type the type of the annotation parameter
30       * @param kind  the kind of the annotation parameter
31       */
32      public AnnotationValueInfo(String name, Object value, String type, Kind kind) {
33          this.name = name;
34          this.value = value;
35          this.type = type;
36          this.kind = kind;
37      }
38  
39      /**
40       * Returns the name of the annotation parameter.
41       *
42       * @return the name
43       */
44      public String getName() {
45          return name;
46      }
47  
48      /**
49       * Returns the value of the parameter.
50       *
51       * @return the value
52       */
53      public Object getValue() {
54          return value;
55      }
56  
57      public String getType() {
58          return type;
59      }
60  
61      public Kind getKind() {
62          return kind;
63      }
64  
65      @Override
66      public String toString() {
67          return "AnnotationValueInfo{" +
68                  "name='" + name + '\'' +
69                  ", value=" + value +
70                  ", type='" + type + '\'' +
71                  ", kind=" + kind +
72                  '}';
73      }
74  
75      public enum Kind {
76          BASIC, ELEMENT, DECLARED_TYPE, LIST
77      }
78  
79  }