1515 */
1616package org .androidannotations .handler ;
1717
18- import static org .androidannotations .helper .ModelConstants .TRACE_OPTION ;
19-
2018import java .util .ArrayList ;
2119import java .util .Collections ;
2220import java .util .HashSet ;
2321import java .util .List ;
24- import java .util .Map ;
2522import java .util .Set ;
2623
2724import javax .annotation .processing .ProcessingEnvironment ;
3532import org .androidannotations .handler .rest .RestHandler ;
3633import org .androidannotations .handler .rest .RestServiceHandler ;
3734import org .androidannotations .helper .AndroidManifest ;
35+ import org .androidannotations .helper .OptionsHelper ;
3836import org .androidannotations .holder .GeneratedClassHolder ;
3937import org .androidannotations .model .AndroidRes ;
4038import org .androidannotations .model .AndroidSystemServices ;
@@ -48,14 +46,17 @@ public class AnnotationHandlers {
4846 private List <GeneratingAnnotationHandler <? extends GeneratedClassHolder >> generatingAnnotationHandlers = new ArrayList <GeneratingAnnotationHandler <? extends GeneratedClassHolder >>();
4947 private List <AnnotationHandler <? extends GeneratedClassHolder >> decoratingAnnotationHandlers = new ArrayList <AnnotationHandler <? extends GeneratedClassHolder >>();
5048 private Set <String > supportedAnnotationNames ;
49+ private OptionsHelper optionsHelper ;
5150
5251 public AnnotationHandlers (ProcessingEnvironment processingEnvironment ) {
52+ optionsHelper = new OptionsHelper (processingEnvironment );
53+
5354 add (new EApplicationHandler (processingEnvironment ));
5455 add (new EActivityHandler (processingEnvironment ));
5556 add (new EProviderHandler (processingEnvironment ));
5657 add (new EReceiverHandler (processingEnvironment ));
5758 add (new EServiceHandler (processingEnvironment ));
58- add (new EIntentServiceHandler (processingEnvironment ));
59+ add (new EIntentServiceHandler (processingEnvironment ));
5960 add (new EFragmentHandler (processingEnvironment ));
6061 add (new EBeanHandler (processingEnvironment ));
6162 add (new EViewGroupHandler (processingEnvironment ));
@@ -107,7 +108,7 @@ public AnnotationHandlers(ProcessingEnvironment processingEnvironment) {
107108 add (new SeekBarProgressChangeHandler (processingEnvironment ));
108109 add (new SeekBarTouchStartHandler (processingEnvironment ));
109110 add (new SeekBarTouchStopHandler (processingEnvironment ));
110- add (new ServiceActionHandler (processingEnvironment ));
111+ add (new ServiceActionHandler (processingEnvironment ));
111112 add (new SubscribeHandler (processingEnvironment ));
112113 add (new ProduceHandler (processingEnvironment ));
113114 add (new InstanceStateHandler (processingEnvironment ));
@@ -120,12 +121,12 @@ public AnnotationHandlers(ProcessingEnvironment processingEnvironment) {
120121 add (new AfterInjectHandler (processingEnvironment ));
121122 add (new AfterViewsHandler (processingEnvironment ));
122123
123- if (traceActivated ( processingEnvironment )) {
124- add (new TraceHandler (processingEnvironment ));
125- }
126- /* UIThreadHandler and BackgroundHandler must be after TraceHandler */
127- add (new UiThreadHandler (processingEnvironment ));
128- add (new BackgroundHandler (processingEnvironment ));
124+ if (optionsHelper . shouldLogTrace ( )) {
125+ add (new TraceHandler (processingEnvironment ));
126+ }
127+ /* UIThreadHandler and BackgroundHandler must be after TraceHandler */
128+ add (new UiThreadHandler (processingEnvironment ));
129+ add (new BackgroundHandler (processingEnvironment ));
129130 }
130131
131132 private void add (AnnotationHandler <? extends GeneratedClassHolder > annotationHandler ) {
@@ -168,16 +169,6 @@ public void setProcessHolder(ProcessHolder processHolder) {
168169 }
169170 }
170171
171- private boolean traceActivated (ProcessingEnvironment processingEnvironment ) {
172- Map <String , String > options = processingEnvironment .getOptions ();
173- if (options .containsKey (TRACE_OPTION )) {
174- String trace = options .get (TRACE_OPTION );
175- return !"false" .equals (trace );
176- } else {
177- return true ;
178- }
179- }
180-
181172 public Set <String > getSupportedAnnotationTypes () {
182173 if (supportedAnnotationNames == null ) {
183174 Set <String > annotationNames = new HashSet <String >();
0 commit comments