@Test public void shouldBeAbleToMoveFlyweights() { Example writer = (Example) newFlyweight(); Example reader = (Example) newFlyweight(); StubFlyweight writeCursor = (StubFlyweight) writer; StubFlyweight readCursor = (StubFlyweight) reader; writeCursor.moveTo(startAddress + EXAMPLE_SIZE_IN_BYTES); readCursor.moveTo(startAddress + EXAMPLE_SIZE_IN_BYTES); writer.setFoo(5); assertEquals(5, reader.getFoo()); writer.setBar(6L); assertEquals(6L, reader.getBar()); }
public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); }
Mapper { public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); } }
Mapper { public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); } Mapper(Class<S> structInterface, boolean debugEnabled); }
Mapper { public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); } Mapper(Class<S> structInterface, boolean debugEnabled); int getSizeInBytes(); I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args); I newFlyweight(Class<I> implementationParent, String templateFileName, Template template, Object... args); }
Mapper { public <I> I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args) { Template template = Template.fromFile(implementationParent, templateFileName); return newFlyweight(implementationParent, templateFileName, template, args); } Mapper(Class<S> structInterface, boolean debugEnabled); int getSizeInBytes(); I newFlyweight(Class<I> implementationParent, String templateFileName, Object... args); I newFlyweight(Class<I> implementationParent, String templateFileName, Template template, Object... args);  }