You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
513 B

  1. package de.fd.fh.server.game;
  2. import dev.morphia.annotations.Embedded;
  3. import lombok.*;
  4. import org.bson.types.ObjectId;
  5. @Getter
  6. @Embedded
  7. @NoArgsConstructor
  8. @AllArgsConstructor(access = AccessLevel.PRIVATE)
  9. @EqualsAndHashCode(of = {"identifier"})
  10. public class GameId
  11. {
  12. private String identifier;
  13. public static GameId of(final String identifier)
  14. {
  15. return new GameId(identifier);
  16. }
  17. public static GameId random()
  18. {
  19. return new GameId(new ObjectId().toHexString());
  20. }
  21. }