GeneratedEntityDecorator implements TranslatorDecorator<Table, Interface> { @Override public void apply(JavaClassTranslator<Table, Interface> translator) { translator.onMake((file, builder) -> builder.forEveryTable(Translator.Phase.POST_MAKE, (intrf, table) -> tableHandler(translator, file, intrf, table) )); } GeneratedEntityDecorator(Injector injector); @Override void apply(JavaClassTranslator<Table, Interface> translator); static final String FROM_DATABASE_METHOD; static final String FROM_DATABASE_ORDINAL_METHOD; static final String TO_DATABASE_METHOD; static final String TO_DATABASE_ORDINAL_METHOD; static final String DATABASE_NAME; static final String DATABASE_ORDINAL; }
@Test void apply() throws InstantiationException { final Injector injector = Injector.builder() .withComponent(StandardJavaLanguageNamer.class) .withComponent(StandardJavaGenerator.class) .withComponent(DelegateInfoComponent.class) .withBundle(EnumGeneratorBundle.class) .build(); final Project project = TestUtil.project(); final Column column = DocumentDbUtil.referencedColumn(project,"speedment_test","speedment_test", "user", "name"); final Table table = column.getParentOrThrow(); final GeneratedEntityDecorator decorator = new GeneratedEntityDecorator(injector); final JavaClassTranslator<Table, Interface> translator = new GeneratedEntityTranslator(injector, table); decorator.apply(translator); final File file = translator.get(); final String code = injector.getOrThrow(Generator.class).on(file).orElseThrow(NoSuchElementException::new); assertTrue(code.contains("enum Name")); assertTrue(code.contains("fromDatabase(String")); }