Skip to content

Instantly share code, notes, and snippets.

@uziassantosferreira
Created November 3, 2016 02:37
Show Gist options
  • Save uziassantosferreira/3aa749bb4d096e3d9e8fb0627ef1b42b to your computer and use it in GitHub Desktop.
Save uziassantosferreira/3aa749bb4d096e3d9e8fb0627ef1b42b to your computer and use it in GitHub Desktop.
Example create enum in android annotation
//Example
User user = new User();
user.age = Numbers.ONE;
@IntDef({Numbers.ONE, Numbers.TWO, Numbers.THREE, Numbers.FOUR})
@Retention(RetentionPolicy.SOURCE)
@interface Numbers {
int ONE = 1;
int TWO = 2;
int THREE = 3;
int FOUR = 4;
}
enum NumbersWithoutAnnotation {
ONE, TWO, THREE, FOUR;
}
class User {
@Numbers
int age;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment