根据http://www.scribd.com/doc/8128172/Preon-Introduction,Preon 可用于将位解码为枚举表示,如下所示:
// Reads a bit from the buffer, and interprets it as an enum value,
// interpreting the number as its ordinal value.
@BoundNumber(size="2")
Type type;
现在,我的问题是:如果你有一个枚举,例如:
00 是否总是映射到 VALUE_A,而 01 总是映射到 VALUE_B,因为它们是按那个(升序?)顺序写的?我可以指望这种情况总是如此吗?枚举在 Java 中以什么方式被重视,Preon 是如何解决这种情况的?
public static enum TestEnum {
VALUE_A, VALUE_B
}