oliviercoma / fluent-builders-generator-eclipse-plugin

Automatically exported from code.google.com/p/fluent-builders-generator-eclipse-plugin
0 stars 0 forks source link

Use Setters with more then one formal parameter #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Enhancement request

Why is it not possible to build the fluent interface for
setter which are have more then one formal input parameter?

E.g, for a small application I want to have a builder to
create some control-flows (if/elseif/else) in a object (see below - MainFlow).

Your version 1.0.9 only detects setters with exact one formal input parameter.

Uwe

MainFlow.java
-----
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.PatternLayout;

public class MainFlow {

    /**
     * @param args
     */
    public static void main(String[] args) {
        BasicConfigurator.configure(new ConsoleAppender (new PatternLayout ("%m [%d:%14t:%C:%L]%n")));

        ControlFlow flow = ControlFlowBuilder.controlFlow()
        .withIf("cond1")
          .withStep("lhs1", "rhs1")
          .withStep("lhs2", "rhs2")
          .withStep("lhs3", "rhs3")
        .withElseIf("cond2")
          .withStep("lhs4", "rhs4")
                .withElse().
                  .withStep("lhs5", "rhs5")
          .build();

    }

}

ControlFlow.java

---
import org.apache.log4j.Logger;

public class ControlFlow {
    private static final Logger logger = Logger.getLogger(ControlFlow.class);

    public void setIF (String expression) {
        logger.info("IF: expression=" + expression);
    }

    public void setStep (String lhsExpression, String rhsExpression) {
        logger.info("  STEP: lhs=" + lhsExpression + " rhs=" + rhsExpression);
    }

    public void setElseIf (String expression) {
        logger.info("ELSEIF: expression=" + expression);
    }

    public void setElse () {
        logger.info("ELSE");
    }

}

Original issue reported on code.google.com by ula.uvula@gmx.de on 17 Nov 2010 at 4:54