diff --git a/docs/src/reference/asciidoc/appendix.adoc b/docs/src/reference/asciidoc/appendix.adoc index e15bfb95..96e07c4f 100644 --- a/docs/src/reference/asciidoc/appendix.adoc +++ b/docs/src/reference/asciidoc/appendix.adoc @@ -36,6 +36,21 @@ image::images/statechart0.png[width=500] include::samples/IntroSample.java[tags=snippetA] ---- +[source,java,indent=0] +---- +include::samples/IntroSample.java[tags=snippetB] +---- + +[source,java,indent=0] +---- +include::samples/IntroSample.java[tags=snippetC] +---- + +[source,java,indent=0] +---- +include::samples/IntroSample.java[tags=snippetD] +---- + [glossary] === Glossary diff --git a/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/IntroSample.java b/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/IntroSample.java index bc8cdead..19cc5df5 100644 --- a/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/IntroSample.java +++ b/spring-statemachine-core/src/test/java/org/springframework/statemachine/docs/IntroSample.java @@ -17,7 +17,9 @@ package org.springframework.statemachine.docs; import java.util.EnumSet; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; +import org.springframework.statemachine.StateMachine; import org.springframework.statemachine.annotation.OnTransition; import org.springframework.statemachine.annotation.WithStateMachine; import org.springframework.statemachine.config.EnableStateMachine; @@ -35,7 +37,9 @@ public class IntroSample { static enum Events { EVENT1, EVENT2 } +// end::snippetA[] +// tag::snippetB[] @Configuration @EnableStateMachine static class Config1 extends EnumStateMachineConfigurerAdapter { @@ -62,7 +66,9 @@ public class IntroSample { .event(Events.EVENT2); } } +// end::snippetB[] +// tag::snippetC[] @WithStateMachine static class MyBean { @@ -74,6 +80,19 @@ public class IntroSample { void toState2() { } } -// end::snippetA[] +// end::snippetC[] + +// tag::snippetD[] + static class MyApp { + + @Autowired + StateMachine stateMachine; + + void doSignals() { + stateMachine.sendEvent(Events.EVENT1); + stateMachine.sendEvent(Events.EVENT2); + } + } +// end::snippetD[] }