@Test void testQuestionWithAnnotatedEnumProtoFile() { Proto proto = generator.generate("org.kie.kogito.test.persons", Collections.singleton(QuestionWithAnnotatedEnum.class)); assertThat(proto).isNotNull(); assertThat(proto.getPackageName()).isEqualTo("org.kie.kogito.test.persons"); assertThat(proto.getSyntax()).isEqualTo("proto2"); assertThat(proto.getMessages()).hasSize(1); ProtoMessage question = proto.getMessages().get(0); assertThat(question).isNotNull(); assertThat(question.getName()).isEqualTo("QuestionWithAnnotatedEnum"); assertThat(question.getJavaPackageOption()).isEqualTo("org.kie.kogito.codegen.data"); assertThat(question.getFields()).hasSize(2); ProtoField field = question.getFields().get(0); assertThat(field).isNotNull(); assertThat(field.getName()).isEqualTo("answer"); assertThat(field.getType()).isEqualTo("AnswerWitAnnotations"); assertThat(field.getApplicability()).isEqualTo("optional"); field = question.getFields().get(1); assertThat(field).isNotNull(); assertThat(field.getName()).isEqualTo("question"); assertThat(field.getType()).isEqualTo("string"); assertThat(field.getApplicability()).isEqualTo("optional"); }
public Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers) { try { Proto proto = new Proto(packageName, headers); for (Class<?> clazz : dataModel) { if (clazz.isEnum()) { enumFromClass(proto, clazz, null); } else { messageFromClass(proto, clazz, null, null, null); } } return proto; } catch (Exception e) { throw new RuntimeException("Error while generating proto for data model", e); } }
ReflectionProtoGenerator extends AbstractProtoGenerator<Class<?>> { public Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers) { try { Proto proto = new Proto(packageName, headers); for (Class<?> clazz : dataModel) { if (clazz.isEnum()) { enumFromClass(proto, clazz, null); } else { messageFromClass(proto, clazz, null, null, null); } } return proto; } catch (Exception e) { throw new RuntimeException("Error while generating proto for data model", e); } } }
ReflectionProtoGenerator extends AbstractProtoGenerator<Class<?>> { public Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers) { try { Proto proto = new Proto(packageName, headers); for (Class<?> clazz : dataModel) { if (clazz.isEnum()) { enumFromClass(proto, clazz, null); } else { messageFromClass(proto, clazz, null, null, null); } } return proto; } catch (Exception e) { throw new RuntimeException("Error while generating proto for data model", e); } }  }
ReflectionProtoGenerator extends AbstractProtoGenerator<Class<?>> { public Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers) { try { Proto proto = new Proto(packageName, headers); for (Class<?> clazz : dataModel) { if (clazz.isEnum()) { enumFromClass(proto, clazz, null); } else { messageFromClass(proto, clazz, null, null, null); } } return proto; } catch (Exception e) { throw new RuntimeException("Error while generating proto for data model", e); } }  Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers); @Override Proto generate(String messageComment, String fieldComment, String packageName, Class<?> dataModel, String... headers); Collection<Class<?>> extractDataClasses(Collection<Class<?>> input, String targetDirectory); }
ReflectionProtoGenerator extends AbstractProtoGenerator<Class<?>> { public Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers) { try { Proto proto = new Proto(packageName, headers); for (Class<?> clazz : dataModel) { if (clazz.isEnum()) { enumFromClass(proto, clazz, null); } else { messageFromClass(proto, clazz, null, null, null); } } return proto; } catch (Exception e) { throw new RuntimeException("Error while generating proto for data model", e); } }  Proto generate(String packageName, Collection<Class<?>> dataModel, String... headers); @Override Proto generate(String messageComment, String fieldComment, String packageName, Class<?> dataModel, String... headers); Collection<Class<?>> extractDataClasses(Collection<Class<?>> input, String targetDirectory);  }