FrankYang0529 commented on PR #74523:
URL: https://github.com/apache/airflow/pull/74523#issuecomment-6160343537
Thanks for the comments and suggestions.
I agree with Jason that Java checks every varargs argument against the same
type. A `before(Object...)` signature would accept the call above, but it would
also accept nodes and labels in any order. Only a runtime check could then
catch a misplaced label.
With each label still paired with its node, two changes may make the Java
code read better. WDYT?
1. Add a `labeled` method to the node so that each call reads more like an
arrow with a label on it:
```java
loaded.before(reportEmpty.labeled("when empty"),
reportSuspicious.labeled("when suspicious"));
cleaned.after(loaded.labeled("always"));
```
A bad part is that `labeled` becomes a reserved name for task methods
inside a task group, because the generated view of a group inherits every
method of the node type.
2. Let `Then`, `Else` and `Case` take a label directly, because labels are
used most often on branches:
```java
dag.If(HasRows.class).Then(load, "rows found").Else(reportEmpty, "no
rows");
dag.Switch(PickPath.class).Case(handleLong, "long").Case(handleShort,
"short");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]