Android枚举写法示例:
@IntDef({
Command.ON,
Command.OFF
})
@Retention(RetentionPolicy.SOURCE)
public @interface Command {
/**
* ON
*/
int ON = 1;
/**
* OFF
*/
int OFF = 2;
}
public void controlLed(@Command int commandId) {
//todo
}