Create Enums

In this lesson we'll create the enumerations we'll need when we start implementing our entities.

We'll implement the enums first as they're the simplest to implement and will allow us to build our domain form the bottom up.

Create our Domain's Enums

Enums in Java provide a way to define a fixed set of constants.

In our ticket platform, enums help us maintain data integrity by restricting certain fields to specific, predefined values.

Let's explore each enum and its purpose:

Event Status

The EventStatusEnum represents the different states an event can be in throughout its lifecycle:

public enum EventStatusEnum { DRAFT, // Initial state when creating an event PUBLISHED, // Event is live and tickets can be purchased CANCELLED, // Event will not take place COMPLETED // Event has finished }

Ticket Status

The TicketStatusEnum tracks the state of purchased tickets:

public enum TicketStatusEnum { PURCHASED, // Default state when ticket is bought CANCELLED // Ticket has been cancelled }

Ticket Validation

We use two enums for ticket validation:

public enum TicketValidationMethod { QR_SCAN, // Ticket validated via QR code scan MANUAL // Ticket validated via manual entry } public enum TicketValidationStatusEnum { VALID, // Ticket is valid for entry INVALID, // Ticket is not valid EXPIRED // Ticket has expired }

QR Code Status

The QrCodeStatusEnum manages the state of QR codes:

public enum QrCodeStatusEnum { ACTIVE, // QR code can be used EXPIRED // QR code has been invalidated }

Summary

  • The EventStatusEnum represents the states an Event could be in
  • The TicketStatusEnum represents the states a Ticket could be in
  • The TicketValidationMethodEnum represents the different way a ticket can be validated
  • The TicketValidationStatusEnum represents the the state a TicketValidation could be in
  • The QrCodeStatusEnum represents the different states a QrCode could be in
© 2026 Devtiro Ltd. All rights reserved