@Test public void testUtf8String() { Utf8String string = new Utf8String("Hello, world!"); assertThat(PlatOnTypeEncoder.encode(string), is("48656c6c6f2c20776f726c6421")); }
@SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt((IntType) parameter); } else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } }
PlatOnTypeEncoder { @SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt((IntType) parameter); } else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } } }
PlatOnTypeEncoder { @SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt((IntType) parameter); } else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } } private  PlatOnTypeEncoder(); }
PlatOnTypeEncoder { @SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt((IntType) parameter); } else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } } private  PlatOnTypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter); }
PlatOnTypeEncoder { @SuppressWarnings("unchecked") public static String encode(Type parameter) { if (parameter instanceof IntType) { return encodeInt((IntType) parameter); } else if (parameter instanceof Utf8String) { return encodeString((Utf8String) parameter); } else { throw new UnsupportedOperationException( "Type cannot be encoded: " + parameter.getClass()); } } private  PlatOnTypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter);  }