Created
May 12, 2015 07:09
-
-
Save yanzm/c514dd807bfc882b97fd 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
/** | |
* サイズId値を保持するクラス | |
* <p/> | |
* 値がセットされていない状態を持つ | |
*/ | |
public class SizeId { | |
public static final int VALID_SIZE1 = 1; | |
public static final int VALID_SIZE2 = 2; | |
@Retention(RetentionPolicy.SOURCE) | |
@IntDef({VALID_SIZE1, VALID_SIZE2}) | |
public @interface ValidSizeId { | |
} | |
public static SizeId valueOf(@ValidSizeId int sizeId) { | |
return new SizeId(sizeId); | |
} | |
private SizeId(@ValidSizeId int sizeId) { | |
this.sizeId = sizeId; | |
} | |
@ValidSizeId | |
private final int sizeId; | |
@ValidSizeId | |
public int getId() { | |
return sizeId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment