62,634
社区成员




public interface OrderState {
/**
* 删除
*/
int DELETED = -1;
/**
* 已创建
*/
int CREATED = 0;
/**
* 已发布
*/
int PUBLISH = 1;
/**
* 已支付
*/
int PAID = 2;
/**
* 已全部发货
*/
int DELIVERY_ALL = 3;
/**
* 交易成功
*/
int SUCCESS = 4;
}
import java.lang.reflect.Field;
public class Main {
public static void main(String[] args) throws Exception {
Field[] fs = OrderState.class.getDeclaredFields();
for(Field f : fs){
System.out.println(f.getName() + ":" + f.getInt(null));
}
}
}
运行结果:
DELETED:-1
CREATED:0
PUBLISH:1
PAID:2
DELIVERY_ALL:3
SUCCESS:4