More on generated routing#183
Conversation
Also: * Improve docs.
| lamp = context.readState(l1) | ||
| // The command was handled via custom routing declared in the class. | ||
| lamp.state shouldBe State.ON |
There was a problem hiding this comment.
| lamp = context.readState(l1) | |
| // The command was handled via custom routing declared in the class. | |
| lamp.state shouldBe State.ON | |
| // The command was handled via custom routing declared in the class. | |
| lamp = context.readState(l1) | |
| lamp.state shouldBe State.ON |
I would put these comments above the block, so that there is an empty before a comment. Then, it is easier to read them.
| fun route(e: RoomEvent): RoomId = e.room | ||
|
|
||
| /** | ||
| * The routing function by event class. |
There was a problem hiding this comment.
| * The routing function by event class. | |
| * The routing function accepting the event class. |
So that the both method are documented in the same style.
| super.setupEventRouting(routing) | ||
| @Assign | ||
| internal fun handle(c: AddDevice): DeviceAdded = | ||
| deviceAdded { device = c.device; name = c.name } |
There was a problem hiding this comment.
Why to have them on the same line? The methods below don't do that.
There was a problem hiding this comment.
Because these functions generate events, while appliers update the state.
Also, I'm experimenting with the compact style for code which merely transforms a command into an event without doing much work.
mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt
Outdated
Show resolved
Hide resolved
mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt
Show resolved
Hide resolved
mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt
Outdated
Show resolved
Hide resolved
| * @param F The type of route functions handled by the visitor. | ||
| * @param setup The type of the routing setup class generated by this visitor. |
There was a problem hiding this comment.
Please have an empty line before the constructor parameters.
...ava-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt
Show resolved
Hide resolved
| * The base class for code generators implementing routing setup classes | ||
| * adding calls to the type of route functions specified by the generic parameter [F]. |
There was a problem hiding this comment.
This sentence is hard to understand.
| // Not duplicated. | ||
| it shouldNotContain "DeviceRegistered" |
There was a problem hiding this comment.
| // Not duplicated. | |
| it shouldNotContain "DeviceRegistered" | |
| // This event should not be duplicated. | |
| it shouldNotContain "DeviceRegistered" |
Also: * Test message parameter name restriction.
This PR continues work on generating routing setup classes.
Changes in details
StateRoutingSetupwas implemented.StateUdateRouteVisitorandEventRouteVisitorgot an abstract baseMulticastRouteVisitorbecause the code generated inside therunblock is basically the same with the only difference with the parameter types.Logger.error().