@Test public void testTerminalsBuildup() throws Exception { var fluent = FluentBuilder.from(TestClass.class) .one("a") .optional("b") .oneOf("a", "b", "c", "d"); var result = new ClassBuilder((FluentBuilderImpl) fluent).build(); assertEqualToFile(result, "testTerminalsBuildup.txt"); }
public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nodes on the top level", list.size()); final var tree = new Tree(Node.ONCE, list); final var exitType = NodeTypeCalculator.from(methods).getReturnType(getLastNode(list)); final var lastInterface = GeciReflectionTools.normalizeTypeName(exitType); LOG.debug("The last type is %s", lastInterface); final var interfaces = build(tree, lastInterface); final var code = JavaSource.builder(); writeStartMethod(code); writeWrapperInterface(code); writeWrapperClass(code); code.write(interfaces); return code.toString(); }
ClassBuilder { public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nodes on the top level", list.size()); final var tree = new Tree(Node.ONCE, list); final var exitType = NodeTypeCalculator.from(methods).getReturnType(getLastNode(list)); final var lastInterface = GeciReflectionTools.normalizeTypeName(exitType); LOG.debug("The last type is %s", lastInterface); final var interfaces = build(tree, lastInterface); final var code = JavaSource.builder(); writeStartMethod(code); writeWrapperInterface(code); writeWrapperClass(code); code.write(interfaces); return code.toString(); } }
ClassBuilder { public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nodes on the top level", list.size()); final var tree = new Tree(Node.ONCE, list); final var exitType = NodeTypeCalculator.from(methods).getReturnType(getLastNode(list)); final var lastInterface = GeciReflectionTools.normalizeTypeName(exitType); LOG.debug("The last type is %s", lastInterface); final var interfaces = build(tree, lastInterface); final var code = JavaSource.builder(); writeStartMethod(code); writeWrapperInterface(code); writeWrapperClass(code); code.write(interfaces); return code.toString(); } ClassBuilder(FluentBuilderImpl fluent); private  ClassBuilder(ClassBuilder that); }
ClassBuilder { public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nodes on the top level", list.size()); final var tree = new Tree(Node.ONCE, list); final var exitType = NodeTypeCalculator.from(methods).getReturnType(getLastNode(list)); final var lastInterface = GeciReflectionTools.normalizeTypeName(exitType); LOG.debug("The last type is %s", lastInterface); final var interfaces = build(tree, lastInterface); final var code = JavaSource.builder(); writeStartMethod(code); writeWrapperInterface(code); writeWrapperClass(code); code.write(interfaces); return code.toString(); } ClassBuilder(FluentBuilderImpl fluent); private  ClassBuilder(ClassBuilder that); String build(); }
ClassBuilder { public String build() throws Exception { LOG.debug("Class building started for the class %s", fluent.getKlass().getSimpleName()); var list = fluent.getNodes(); if (list.size() == 0) { throw new GeciException("There are no actual calls in the fluent structure."); } LOG.debug("There are %d nodes on the top level", list.size()); final var tree = new Tree(Node.ONCE, list); final var exitType = NodeTypeCalculator.from(methods).getReturnType(getLastNode(list)); final var lastInterface = GeciReflectionTools.normalizeTypeName(exitType); LOG.debug("The last type is %s", lastInterface); final var interfaces = build(tree, lastInterface); final var code = JavaSource.builder(); writeStartMethod(code); writeWrapperInterface(code); writeWrapperClass(code); code.write(interfaces); return code.toString(); } ClassBuilder(FluentBuilderImpl fluent); private  ClassBuilder(ClassBuilder that); String build();  }