Android - Annotations

About

This type of annotation are great for debugging.

Implementation

Project Dependency

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

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 {}

Documentation / Reference


Powered by ComboStrap