Android - Annotations

> Android

1 - About

This type of annotation are great for debugging.

2 - Implementation

2.1 - Project Dependency

The support-annotations library must be a dependency of the project.

2.2 - Snippet

public static final int STATUS_OK = 0;
public static final int STATUS_SERVER_DOWN = 1;
public static final int STATUS_SERVER_INVALID = 2;
public static final int STATUS_UNKNOWN = 3;
public static final int STATUS_INVALID = 4;
 
// The annotated interface
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATUS_OK, STATUS_SERVER_DOWN, STATUS_SERVER_INVALID,  STATUS_UNKNOWN, STATUS_INVALID})
public @interface Status {}

3 - Documentation / Reference

Advertising