Module 14: Enums and Annotations
Mini-Project: Ticket Workflow
Build a small ticket workflow using enums to model valid states and transitions.
Author
Java Learner Editorial Team
Reviewer
Technical review by Java Learner
Last reviewed
2026-04-17
Java version
Java 25 LTS
Learning goals
- Use enums to model a closed set of workflow states
- Keep transition rules explicit and readable
- Apply annotations for lightweight metadata or validation hints
Project goal: Build a small ticket or task workflow with states like OPEN, IN_PROGRESS, BLOCKED, and DONE.
What to practice: Enum-driven state handling, transition validation, and maybe one custom annotation for methods that require a certain state.
Design aim: Invalid transitions should fail clearly instead of slipping through as silent bad strings.
Success check: The workflow should feel typed, readable, and hard to misuse accidentally.
Runnable examples
An enum makes valid states explicit
enum TicketState {
OPEN, IN_PROGRESS, DONE
}Expected output
Only the declared workflow states are valid.
Mini exercise
Implement three ticket states first, then add a guard that blocks moving from `DONE` back to `OPEN`.
Summary
- Enums are excellent for workflow state modeling.
- Annotations can add useful metadata around those transitions.
- This project closes the intermediate track by combining type safety and clarity.
Next step
From here, you can move into the advanced track: concurrency, database access, Spring Boot, and larger capstones.
Sources used