Created
December 21, 2015 12:31
-
-
Save Tetz/fa6bb3b51cbeef7fc890 to your computer and use it in GitHub Desktop.
modern-web/app/services/UUIDGenerator.scala
This file contains hidden or 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 services | |
| import javax.inject.Singleton | |
| import java.util.UUID | |
| /** | |
| * A type declaring the interface that will be injectable. | |
| */ | |
| abstract class UUIDGenerator() { | |
| def generate: UUID | |
| } | |
| /** | |
| * A simple implementation of UUIDGenerator that we will inject. | |
| */ | |
| @Singleton | |
| class SimpleUUIDGenerator extends UUIDGenerator { | |
| def generate: UUID = UUID.randomUUID() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment