Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Per this thread on slack, we could introduce a Parameters object (in Java 14+, this might be a record) to bring together all of the parameters into a single object.  This would make it easier to avoid issues with numbering etc.

Code Block
languagejava
public class Customer {

    public class PlaceOrderParameters {
        Product product;
        int quantity;
    }

    public Customer placeOrder(Product p, int quantity) { ... }

    public boolean hidePlaceOrder() { ... }
    public String disablePlaceOrder() { ... }
    public String disable1PlaceOrder(PlaceOrderParameters params) { ... }
    public Collection<Product> choices0PlaceOrder() { ... }              
    public Product default0PlaceOrder() { ... }
    public int default1PlaceOrder() { ... }
    public String validate1PlaceOrder(PlaceOrderParameters params) { ... }
    public String validatePlaceOrder(PlaceOrderParameters params) { ... }
}


There are two variants here.  The first just uses the Parameters object for the supporting methods:


public class Customer { ... }

@Action // or @Mixin(method="act") and a bunch of other annotations
public class Customer_placeOrder() { // infer action name from the mixin class name

private final Customer target; // constructor omitted

public Customer act(Product p, int quantity) { ... }
public boolean hideAct() { ... }
public String disableAct() { ... }
public String disable1Act(Product p) { ... }
public Collection<Product> choices0Act() { ... }
public Product default0Act() { ... }
public int default1Act() { ...}
public String validate1Act(int quantity) { ... }
public String validateAct(Product p, int quantity) { ... }
}




This would also be supported within mixins, for no extra workxxx