Skip to content

Instantly share code, notes, and snippets.

@yanzm
Created May 12, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanzm/c514dd807bfc882b97fd to your computer and use it in GitHub Desktop.
Save yanzm/c514dd807bfc882b97fd to your computer and use it in GitHub Desktop.
/**
* サイズ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