@Test public void testForType() { assertThat(BinaryType.forType(PType.VOID), is(BinaryType.VOID)); assertThat(BinaryType.forType(PType.BOOL), is(BinaryType.BOOL)); assertThat(BinaryType.forType(PType.BYTE), is(BinaryType.BYTE)); assertThat(BinaryType.forType(PType.DOUBLE), is(BinaryType.DOUBLE)); assertThat(BinaryType.forType(PType.I16), is(BinaryType.I16)); assertThat(BinaryType.forType(PType.I32), is(BinaryType.I32)); assertThat(BinaryType.forType(PType.I64), is(BinaryType.I64)); assertThat(BinaryType.forType(PType.STRING), is(BinaryType.STRING)); assertThat(BinaryType.forType(PType.BINARY), is(BinaryType.STRING)); assertThat(BinaryType.forType(PType.MESSAGE),is(BinaryType.STRUCT)); assertThat(BinaryType.forType(PType.ENUM), is(BinaryType.I32)); assertThat(BinaryType.forType(PType.MAP), is(BinaryType.MAP)); assertThat(BinaryType.forType(PType.SET), is(BinaryType.SET)); assertThat(BinaryType.forType(PType.LIST), is(BinaryType.LIST)); }
public static byte forType(@Nonnull PType type) { switch (type) { case VOID: return VOID; case BOOL: return BOOL; case BYTE: return BYTE; case I16: return I16; case I32: return I32; case I64: return I64; case DOUBLE: return DOUBLE; case STRING: return STRING; case BINARY: return STRING; case ENUM: return I32; case MAP: return MAP; case SET: return SET; case LIST: return LIST; case MESSAGE: return STRUCT; default: throw new IllegalArgumentException("Unknown binary type for " + type.toString()); } }
BinaryType { public static byte forType(@Nonnull PType type) { switch (type) { case VOID: return VOID; case BOOL: return BOOL; case BYTE: return BYTE; case I16: return I16; case I32: return I32; case I64: return I64; case DOUBLE: return DOUBLE; case STRING: return STRING; case BINARY: return STRING; case ENUM: return I32; case MAP: return MAP; case SET: return SET; case LIST: return LIST; case MESSAGE: return STRUCT; default: throw new IllegalArgumentException("Unknown binary type for " + type.toString()); } } }
BinaryType { public static byte forType(@Nonnull PType type) { switch (type) { case VOID: return VOID; case BOOL: return BOOL; case BYTE: return BYTE; case I16: return I16; case I32: return I32; case I64: return I64; case DOUBLE: return DOUBLE; case STRING: return STRING; case BINARY: return STRING; case ENUM: return I32; case MAP: return MAP; case SET: return SET; case LIST: return LIST; case MESSAGE: return STRUCT; default: throw new IllegalArgumentException("Unknown binary type for " + type.toString()); } } private  BinaryType(); }
BinaryType { public static byte forType(@Nonnull PType type) { switch (type) { case VOID: return VOID; case BOOL: return BOOL; case BYTE: return BYTE; case I16: return I16; case I32: return I32; case I64: return I64; case DOUBLE: return DOUBLE; case STRING: return STRING; case BINARY: return STRING; case ENUM: return I32; case MAP: return MAP; case SET: return SET; case LIST: return LIST; case MESSAGE: return STRUCT; default: throw new IllegalArgumentException("Unknown binary type for " + type.toString()); } } private  BinaryType(); static byte forType(@Nonnull PType type); static String asString(byte id); }
BinaryType { public static byte forType(@Nonnull PType type) { switch (type) { case VOID: return VOID; case BOOL: return BOOL; case BYTE: return BYTE; case I16: return I16; case I32: return I32; case I64: return I64; case DOUBLE: return DOUBLE; case STRING: return STRING; case BINARY: return STRING; case ENUM: return I32; case MAP: return MAP; case SET: return SET; case LIST: return LIST; case MESSAGE: return STRUCT; default: throw new IllegalArgumentException("Unknown binary type for " + type.toString()); } } private  BinaryType(); static byte forType(@Nonnull PType type); static String asString(byte id); static final byte STOP; static final byte VOID; static final byte BOOL; static final byte BYTE; static final byte DOUBLE; static final byte I16; static final byte I32; static final byte I64; static final byte STRING; static final byte STRUCT; static final byte MAP; static final byte SET; static final byte LIST; }