Created
August 19, 2014 19:51
-
-
Save deximat/9fe0c1ef4ee891e6f644 to your computer and use it in GitHub Desktop.
Simple trick to having fields in enums for immutable objects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.codlex.deximat.raf.third_year.web_programming.exam.project.part2.messages; | |
public enum CancelReservationResponse { | |
PASSENGER_DOESNT_EXIST("Reservation cancellation unssuccesful selected passinger doesn't exist."), | |
FLIGHT_DOESNT_EXIST("Reservation cancellation unssuccesful selected flight doesn't exist."), | |
RESERVATION_NOT_POSSIBLE_TOO_LATE("Reservations can't be canceled if flight is within next 24 hours."), | |
SUCCESS(null), | |
WRONG_FLIGHT("Reservation cancellation unssuccesful selected passinger isn't on flight."); | |
private String description; | |
private CancelReservationResponse(String description) { | |
this.description = description; | |
} | |
public String getDescription() { | |
return this.description; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment