Skip to content

Commit f72fb55

Browse files
committed
Avoids writing the state chain information when the chain is empty. So
the 'chain' annotation attribute now has a default value of '{}'.
1 parent 7b563e7 commit f72fb55

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

flapi-runtime/src/main/java/unquietcode/tools/flapi/runtime/MethodInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
@Target(ElementType.METHOD)
3333
public @interface MethodInfo {
3434
TransitionType type();
35-
Class<?>[] chain();
35+
Class<?>[] chain() default {};
3636
Class<?> next() default MethodInfo.class;
3737
}

src/main/java/unquietcode/tools/flapi/graph/processors/GraphProcessor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ public void visit(LateralTransition transition) {
8181
});
8282

8383
// store the type information for the state chain
84-
JAnnotationArrayMember chain = infoAnnotation.paramArray("chain");
84+
if (!transition.getStateChain().isEmpty()) {
85+
JAnnotationArrayMember chain = infoAnnotation.paramArray("chain");
8586

86-
for (StateClass sc : transition.getStateChain()) {
87-
JDefinedClass type = BUILDER_INTERFACE_STRATEGY.createType(ctx, sc);
88-
chain.param(type);
87+
for (StateClass sc : transition.getStateChain()) {
88+
JDefinedClass type = BUILDER_INTERFACE_STRATEGY.createType(ctx, sc);
89+
chain.param(type);
90+
}
8991
}
9092

9193
// if it's an atLeast method, requiring tracking

0 commit comments

Comments
 (0)