Android Annotation Processor edit

Creating and Using Custom Annotations

For creating custom annotations we need to decide

For this, we have built in custom annotations. Check out these mostly used ones:

@Target

 

@Retention

 

Creating Custom Annotation

@Retention(RetentionPolicy.SOURCE) // will not be available in compiled class   
@Target(ElementType.METHOD) // can be applied to methods only
@interface CustomAnnotation{  
      int value();    
}

Using Custom Annotation

class Foo{  
  @CustomAnnotation(value = 1)  // will be used by an annotation processor
  public void foo(){..}  
}

the value provided inside @CustomAnnotation will be consumed by an Annotationprocessor may be to generate code at compile time etc.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Table Of Contents
39 ACRA
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
259 Annotation Processor
  ↑ ↓ to navigate     ↵ to select     Esc to close