protected void addAndThen(JavaInterfaceSource type, ClassPlan plan) { /* final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.addParameter( plan.getClassName() + "Consumer<T>", "after" ); method.setName("andThen") .setBody( "return (c)->{ this.accept(c); after.accept(c); };") .setReturnType( plan.getClassName() +"Consumer<T>" ) .setDefault(true); */ type.addMethod( "default " + plan.getClassName() + "Consumer<T> andThen(" + plan.getClassName() + "Consumer<T> after) {\n" + " return (c)->{ this.accept(c); after.accept(c);};\n" + "}\n"); }
protected void addAndThen(JavaInterfaceSource type, ClassPlan plan) { /* final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.addParameter( plan.getClassName() + "Consumer<T>", "after" ); method.setName("andThen") .setBody( "return (c)->{ this.accept(c); after.accept(c); };") .setReturnType( plan.getClassName() +"Consumer<T>" ) .setDefault(true); */ type.addMethod( "default " + plan.getClassName() + "Consumer<T> andThen(" + plan.getClassName() + "Consumer<T> after) {\n" + " return (c)->{ this.accept(c); after.accept(c);};\n" + "}\n"); }
protected void addGet(JavaInterfaceSource type, ClassPlan plan) { final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.getJavaDoc() .setText("Constructed instance of " + plan.getClassName() + " resource") .addTagValue("@return", "The instance"); method.setPublic() .setName("get") .setReturnType(plan.getClassName()); }
protected void addGet(JavaInterfaceSource type, ClassPlan plan) { final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.getJavaDoc() .setText("Constructed instance of " + plan.getClassName() + " resource") .addTagValue("@return", "The instance"); method.setPublic() .setName("get") .setReturnType(plan.getClassName()); }
protected void addAccept(JavaInterfaceSource type, ClassPlan plan) { final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.getJavaDoc() .setText("Configure a pre-constructed instance of " + plan.getClassName() + " resource") .addTagValue("@parameter", "Instance of " + plan.getClassName() + " to configure") .addTagValue("@return", "nothing"); method.addParameter("T", "value"); method.setName("accept") .setReturnType("void"); }
protected void addAccept(JavaInterfaceSource type, ClassPlan plan) { final MethodSource<JavaInterfaceSource> method = type.addMethod(); method.getJavaDoc() .setText("Configure a pre-constructed instance of " + plan.getClassName() + " resource") .addTagValue("@parameter", "Instance of " + plan.getClassName() + " to configure") .addTagValue("@return", "nothing"); method.addParameter("T", "value"); method.setName("accept") .setReturnType("void"); }