|
23 | 23 | import javax.lang.model.element.Element; |
24 | 24 |
|
25 | 25 | import org.androidannotations.handler.AnnotationHandler; |
26 | | -import org.androidannotations.handler.AnnotationHandlers; |
27 | 26 | import org.androidannotations.handler.GeneratingAnnotationHandler; |
28 | 27 | import org.androidannotations.helper.AndroidManifest; |
29 | 28 | import org.androidannotations.holder.GeneratedClassHolder; |
30 | | -import org.androidannotations.model.AndroidSystemServices; |
31 | | -import org.androidannotations.model.AnnotationElements; |
| 29 | +import org.androidannotations.internal.model.AnnotationElements; |
| 30 | +import org.androidannotations.internal.process.ProcessHolder; |
32 | 31 | import org.androidannotations.plugin.AndroidAnnotationsPlugin; |
33 | | -import org.androidannotations.process.Option; |
34 | | -import org.androidannotations.process.Options; |
35 | | -import org.androidannotations.process.ProcessHolder; |
36 | 32 | import org.androidannotations.rclass.IRClass; |
37 | 33 |
|
38 | 34 | import com.sun.codemodel.JClass; |
39 | 35 | import com.sun.codemodel.JCodeModel; |
40 | 36 | import com.sun.codemodel.JDefinedClass; |
41 | 37 |
|
42 | | -public class AndroidAnnotationsEnvironment { |
| 38 | +public interface AndroidAnnotationsEnvironment { |
43 | 39 |
|
44 | | - private final ProcessingEnvironment processingEnvironment; |
45 | | - private final Options options; |
46 | | - private final AnnotationHandlers annotationHandlers; |
| 40 | + ProcessingEnvironment getProcessingEnvironment(); |
47 | 41 |
|
48 | | - private List<AndroidAnnotationsPlugin> plugins; |
| 42 | + Set<String> getSupportedOptions(); |
49 | 43 |
|
50 | | - private IRClass rClass; |
51 | | - private AndroidSystemServices androidSystemServices; |
52 | | - private AndroidManifest androidManifest; |
| 44 | + String getOptionValue(Option option); |
53 | 45 |
|
54 | | - private AnnotationElements validatedElements; |
| 46 | + String getOptionValue(String optionKey); |
55 | 47 |
|
56 | | - private ProcessHolder processHolder; |
| 48 | + boolean getOptionBooleanValue(Option option); |
57 | 49 |
|
58 | | - AndroidAnnotationsEnvironment(ProcessingEnvironment processingEnvironment) { |
59 | | - this.processingEnvironment = processingEnvironment; |
60 | | - options = new Options(processingEnvironment); |
61 | | - annotationHandlers = new AnnotationHandlers(); |
62 | | - androidSystemServices = new AndroidSystemServices(this); |
63 | | - } |
| 50 | + boolean getOptionBooleanValue(String optionKey); |
64 | 51 |
|
65 | | - public void setPlugins(List<AndroidAnnotationsPlugin> plugins) { |
66 | | - this.plugins = plugins; |
67 | | - for (AndroidAnnotationsPlugin plugin : plugins) { |
68 | | - options.addAllSupportedOptions(plugin.getSupportedOptions()); |
69 | | - plugin.addHandlers(annotationHandlers, this); |
70 | | - } |
71 | | - } |
| 52 | + Set<String> getSupportedAnnotationTypes(); |
72 | 53 |
|
73 | | - public void setAndroidEnvironment(IRClass rClass, AndroidManifest androidManifest) { |
74 | | - this.rClass = rClass; |
75 | | - this.androidManifest = androidManifest; |
76 | | - } |
| 54 | + List<AnnotationHandler<? extends GeneratedClassHolder>> getHandlers(); |
77 | 55 |
|
78 | | - public void setValidatedElements(AnnotationElements validatedElements) { |
79 | | - this.validatedElements = validatedElements; |
80 | | - } |
| 56 | + List<AnnotationHandler<? extends GeneratedClassHolder>> getDecoratingHandlers(); |
81 | 57 |
|
82 | | - public void setProcessHolder(ProcessHolder processHolder) { |
83 | | - this.processHolder = processHolder; |
84 | | - } |
| 58 | + List<GeneratingAnnotationHandler<? extends GeneratedClassHolder>> getGeneratingHandlers(); |
85 | 59 |
|
86 | | - public ProcessingEnvironment getProcessingEnvironment() { |
87 | | - return processingEnvironment; |
88 | | - } |
| 60 | + IRClass getRClass(); |
89 | 61 |
|
90 | | - public Set<String> getSupportedOptions() { |
91 | | - return options.getSupportedOptions(); |
92 | | - } |
| 62 | + AndroidManifest getAndroidManifest(); |
93 | 63 |
|
94 | | - public String getOptionValue(Option option) { |
95 | | - return options.get(option); |
96 | | - } |
| 64 | + AnnotationElements getValidatedElements(); |
97 | 65 |
|
98 | | - public String getOptionValue(String optionKey) { |
99 | | - return options.get(optionKey); |
100 | | - } |
| 66 | + JCodeModel getCodeModel(); |
101 | 67 |
|
102 | | - public boolean getOptionBooleanValue(Option option) { |
103 | | - return options.getBoolean(option); |
104 | | - } |
| 68 | + JClass getJClass(String fullyQualifiedName); |
105 | 69 |
|
106 | | - public boolean getOptionBooleanValue(String optionKey) { |
107 | | - return options.getBoolean(optionKey); |
108 | | - } |
| 70 | + JClass getJClass(Class<?> clazz); |
109 | 71 |
|
110 | | - public Set<String> getSupportedAnnotationTypes() { |
111 | | - return annotationHandlers.getSupportedAnnotationTypes(); |
112 | | - } |
| 72 | + JDefinedClass getDefinedClass(String fullyQualifiedName); |
113 | 73 |
|
114 | | - public List<AnnotationHandler<? extends GeneratedClassHolder>> getHandlers() { |
115 | | - return annotationHandlers.get(); |
116 | | - } |
| 74 | + GeneratedClassHolder getGeneratedClassHolder(Element element); |
117 | 75 |
|
118 | | - public List<AnnotationHandler<? extends GeneratedClassHolder>> getDecoratingHandlers() { |
119 | | - return annotationHandlers.getDecorating(); |
120 | | - } |
| 76 | + ProcessHolder.Classes getClasses(); |
121 | 77 |
|
122 | | - public List<GeneratingAnnotationHandler<? extends GeneratedClassHolder>> getGeneratingHandlers() { |
123 | | - return annotationHandlers.getGenerating(); |
124 | | - } |
| 78 | + List<Class<? extends Annotation>> getGeneratingAnnotations(); |
125 | 79 |
|
126 | | - public IRClass getRClass() { |
127 | | - return rClass; |
128 | | - } |
| 80 | + boolean isAndroidAnnotation(String annotationQualifiedName); |
129 | 81 |
|
130 | | - public AndroidSystemServices getAndroidSystemServices() { |
131 | | - return androidSystemServices; |
132 | | - } |
133 | | - |
134 | | - public AndroidManifest getAndroidManifest() { |
135 | | - return androidManifest; |
136 | | - } |
137 | | - |
138 | | - public AnnotationElements getValidatedElements() { |
139 | | - return validatedElements; |
140 | | - } |
141 | | - |
142 | | - public JCodeModel getCodeModel() { |
143 | | - return processHolder.codeModel(); |
144 | | - } |
145 | | - |
146 | | - public JClass getJClass(String fullyQualifiedName) { |
147 | | - return processHolder.refClass(fullyQualifiedName); |
148 | | - } |
149 | | - |
150 | | - public JClass getJClass(Class<?> clazz) { |
151 | | - return processHolder.refClass(clazz); |
152 | | - } |
153 | | - |
154 | | - public JDefinedClass getDefinedClass(String fullyQualifiedName) { |
155 | | - return processHolder.definedClass(fullyQualifiedName); |
156 | | - } |
157 | | - |
158 | | - public GeneratedClassHolder getGeneratedClassHolder(Element element) { |
159 | | - return processHolder.getGeneratedClassHolder(element); |
160 | | - } |
161 | | - |
162 | | - public ProcessHolder.Classes getClasses() { |
163 | | - return processHolder.classes(); |
164 | | - } |
165 | | - |
166 | | - public List<Class<? extends Annotation>> getGeneratingAnnotations() { |
167 | | - return annotationHandlers.getGeneratingAnnotations(); |
168 | | - } |
169 | | - |
170 | | - public boolean isAndroidAnnotation(String annotationQualifiedName) { |
171 | | - return getSupportedAnnotationTypes().contains(annotationQualifiedName); |
172 | | - } |
173 | | - |
174 | | - public List<AndroidAnnotationsPlugin> getPlugins() { |
175 | | - return plugins; |
176 | | - } |
| 82 | + List<AndroidAnnotationsPlugin> getPlugins(); |
177 | 83 | } |
0 commit comments