Last active
August 29, 2015 14:21
-
-
Save zaki50/d09070c76f7532a7df1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Size { | |
| L(SIZE_L), M(SIZE_M), S(SIZE_S); | |
| @ValidSize | |
| private final int rawValue; | |
| Size(@ValidSize int rawValue) { | |
| this.rawValue = rawValue; | |
| } | |
| @ValidSize | |
| public int getRawValue() { | |
| return rawValue; | |
| } | |
| @Retention(RetentionPolicy.SOURCE) | |
| @IntDef({SIZE_L, SIZE_M, SIZE_S}) | |
| public @interface ValidSize { | |
| int SIZE_L = 1; | |
| int SIZE_M = 2; | |
| int SIZE_S = 3; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment