@Test public void testGenerateJavaCode2() { DataValueGenerator dvg = new DataValueGenerator(); MinimalInterface mi = dvg.heapInstance(MinimalInterface.class); mi.byte$((byte) 1); mi.char$('2'); mi.short$((short) 3); mi.int$(4); mi.float$(5); mi.long$(6); mi.double$(7); mi.flag(true); assertEquals(1, mi.byte$()); assertEquals('2', mi.char$()); assertEquals(3, mi.short$()); assertEquals(4, mi.int$()); assertEquals(5.0, mi.float$(), 0); assertEquals(6, mi.long$()); assertEquals(7.0, mi.double$(), 0.0); assertTrue(mi.flag()); Bytes bbb = ByteBufferBytes.wrap(ByteBuffer.allocate(64)); mi.writeMarshallable(bbb); System.out.println("size: " + bbb.position()); MinimalInterface mi2 = dvg.heapInstance(MinimalInterface.class); bbb.position(0); mi2.readMarshallable(bbb); assertEquals(1, mi2.byte$()); assertEquals('2', mi2.char$()); assertEquals(3, mi2.short$()); assertEquals(4, mi2.int$()); assertEquals(5.0, mi2.float$(), 0); assertEquals(6, mi2.long$()); assertEquals(7.0, mi2.double$(), 0.0); assertTrue(mi2.flag()); }
public <T> T heapInstance(Class<T> tClass) { try { return (T) acquireHeapClass(tClass).newInstance(); } catch (Exception e) { throw new AssertionError(e); } }
DataValueGenerator { public <T> T heapInstance(Class<T> tClass) { try { return (T) acquireHeapClass(tClass).newInstance(); } catch (Exception e) { throw new AssertionError(e); } } }
DataValueGenerator { public <T> T heapInstance(Class<T> tClass) { try { return (T) acquireHeapClass(tClass).newInstance(); } catch (Exception e) { throw new AssertionError(e); } }  }
DataValueGenerator { public <T> T heapInstance(Class<T> tClass) { try { return (T) acquireHeapClass(tClass).newInstance(); } catch (Exception e) { throw new AssertionError(e); } }  static Class firstPrimitiveFieldType(Class valueClass); static String bytesType(Class type); static String simpleName(Class<?> type); static CharSequence normalize(Class aClass); static Method getGetter(FieldModel model); static Method getVolatileGetter(FieldModel model); static Method getSetter(FieldModel model); static Method getOrderedSetter(FieldModel model); static void appendImported(SortedSet<Class> imported, StringBuilder sb); static void appendPackage(DataValueModel<?> dvmodel, StringBuilder sb); static String getPackage(DataValueModel<?> dvmodel); static int fieldSize(FieldModel model); static TreeSet<Class> newImported(); static boolean shouldImport(Class type); static Map.Entry<String, FieldModel>[] heapSizeOrderedFieldsGrouped(DataValueModel<?> dvmodel); static int computeOffset(int offset, FieldModel model); static int computeNonScalarOffset(DataValueModel dvmodel, Class type); T heapInstance(Class<T> tClass); Class acquireHeapClass(Class<T> tClass); T nativeInstance(Class<T> tClass); Class acquireNativeClass(Class<T> tClass); String generateNativeObject(Class<?> tClass); String generateNativeObject(DataValueModel<?> dvmodel); boolean isDumpCode(); void setDumpCode(boolean dumpCode); }
DataValueGenerator { public <T> T heapInstance(Class<T> tClass) { try { return (T) acquireHeapClass(tClass).newInstance(); } catch (Exception e) { throw new AssertionError(e); } }  static Class firstPrimitiveFieldType(Class valueClass); static String bytesType(Class type); static String simpleName(Class<?> type); static CharSequence normalize(Class aClass); static Method getGetter(FieldModel model); static Method getVolatileGetter(FieldModel model); static Method getSetter(FieldModel model); static Method getOrderedSetter(FieldModel model); static void appendImported(SortedSet<Class> imported, StringBuilder sb); static void appendPackage(DataValueModel<?> dvmodel, StringBuilder sb); static String getPackage(DataValueModel<?> dvmodel); static int fieldSize(FieldModel model); static TreeSet<Class> newImported(); static boolean shouldImport(Class type); static Map.Entry<String, FieldModel>[] heapSizeOrderedFieldsGrouped(DataValueModel<?> dvmodel); static int computeOffset(int offset, FieldModel model); static int computeNonScalarOffset(DataValueModel dvmodel, Class type); T heapInstance(Class<T> tClass); Class acquireHeapClass(Class<T> tClass); T nativeInstance(Class<T> tClass); Class acquireNativeClass(Class<T> tClass); String generateNativeObject(Class<?> tClass); String generateNativeObject(DataValueModel<?> dvmodel); boolean isDumpCode(); void setDumpCode(boolean dumpCode);  }