6
6
import java .util .HashMap ;
7
7
import java .util .List ;
8
8
import java .util .Map ;
9
- import java .util .Optional ;
10
9
import java .util .stream .Stream ;
11
10
12
11
import javax .lang .model .element .AnnotationMirror ;
@@ -36,13 +35,6 @@ final class GeneratePrismPrism {
36
35
37
36
public static final String PRISM_TYPE = "io.avaje.prism.GeneratePrism" ;
38
37
39
- /**
40
- * An instance of the Values inner class whose
41
- * methods return the AnnotationValues used to build this prism.
42
- * Primarily intended to support using Messager.
43
- */
44
- final Values values ;
45
-
46
38
/** Returns true if the prism annotation is present on the element, else false.
47
39
*
48
40
* @param element element.
@@ -66,20 +58,6 @@ static GeneratePrismPrism getInstanceOn(Element element) {
66
58
return getInstance (mirror );
67
59
}
68
60
69
- /** Return a Optional representing a nullable {@code @io.avaje.prism.GeneratePrism} annotation on 'e'.
70
- * similar to {@code element.getAnnotation(io.avaje.prism.GeneratePrism.class)} except that
71
- * an Optional of this class rather than an instance of {@code io.avaje.prism.GeneratePrism}
72
- * is returned.
73
- *
74
- * @param element element.
75
- * @return prism optional for element.
76
- */
77
- static Optional <GeneratePrismPrism > getOptionalOn (Element element ) {
78
- final var mirror = getMirror (element );
79
- if (mirror == null ) return Optional .empty ();
80
- return getOptional (mirror );
81
- }
82
-
83
61
/** Return a list of prisms representing the {@code @io.avaje.prism.GeneratePrism} annotation on 'e'.
84
62
* similar to {@code e.getAnnotationsByType(io.avaje.prism.GeneratePrism.class)} except that
85
63
* instances of this class rather than instances of {@code io.avaje.prism.GeneratePrism}
@@ -105,20 +83,6 @@ static GeneratePrismPrism getInstance(AnnotationMirror mirror) {
105
83
return new GeneratePrismPrism (mirror );
106
84
}
107
85
108
- /** Return a {@code Optional<GeneratePrismPrism>} representing a {@code @io.avaje.prism.GeneratePrism} annotation mirror.
109
- * similar to {@code e.getAnnotation(io.avaje.prism.GeneratePrism.class)} except that
110
- * an Optional of this class rather than an instance of {@code io.avaje.prism.GeneratePrism}
111
- * is returned.
112
- *
113
- * @param mirror mirror.
114
- * @return prism optional for mirror.
115
- */
116
- static Optional <GeneratePrismPrism > getOptional (AnnotationMirror mirror ) {
117
- if (mirror == null || !PRISM_TYPE .equals (mirror .getAnnotationType ().toString ())) return Optional .empty ();
118
-
119
- return Optional .of (new GeneratePrismPrism (mirror ));
120
- }
121
-
122
86
private GeneratePrismPrism (AnnotationMirror mirror ) {
123
87
for (final ExecutableElement key : mirror .getElementValues ().keySet ()) {
124
88
memberValues .put (key .getSimpleName ().toString (), mirror .getElementValues ().get (key ));
@@ -131,7 +95,6 @@ private GeneratePrismPrism(AnnotationMirror mirror) {
131
95
_publicAccess = getValue ("publicAccess" , Boolean .class );
132
96
_superClass = getValue ("superClass" , TypeMirror .class );
133
97
_superInterfaces = getArrayValues ("superInterfaces" , TypeMirror .class );
134
- this .values = new Values (memberValues );
135
98
this .mirror = mirror ;
136
99
this .isValid = valid ;
137
100
}
@@ -181,39 +144,7 @@ private GeneratePrismPrism(AnnotationMirror mirror) {
181
144
* Primarily intended to support using Messager.
182
145
*/
183
146
final AnnotationMirror mirror ;
184
- /**
185
- * A class whose members corespond to those of io.avaje.prism.GeneratePrism
186
- * but which each return the AnnotationValue corresponding to
187
- * that member in the model of the annotations. Returns null for
188
- * defaulted members. Used for Messager, so default values are not useful.
189
- */
190
- static final class Values {
191
- private final Map <String , AnnotationValue > values ;
192
147
193
- private Values (Map <String , AnnotationValue > values ) {
194
- this .values = values ;
195
- }
196
- /** Return the AnnotationValue corresponding to the value()
197
- * member of the annotation, or null when the default value is implied.
198
- */
199
- AnnotationValue value (){ return values .get ("value" );}
200
- /** Return the AnnotationValue corresponding to the name()
201
- * member of the annotation, or null when the default value is implied.
202
- */
203
- AnnotationValue name (){ return values .get ("name" );}
204
- /** Return the AnnotationValue corresponding to the publicAccess()
205
- * member of the annotation, or null when the default value is implied.
206
- */
207
- AnnotationValue publicAccess (){ return values .get ("publicAccess" );}
208
- /** Return the AnnotationValue corresponding to the superClass()
209
- * member of the annotation, or null when the default value is implied.
210
- */
211
- AnnotationValue superClass (){ return values .get ("superClass" );}
212
- /** Return the AnnotationValue corresponding to the superInterfaces()
213
- * member of the annotation, or null when the default value is implied.
214
- */
215
- AnnotationValue superInterfaces (){ return values .get ("superInterfaces" );}
216
- }
217
148
218
149
private final Map <String , AnnotationValue > defaults = new HashMap <>(10 );
219
150
private final Map <String , AnnotationValue > memberValues = new HashMap <>(10 );
0 commit comments