Created
December 15, 2014 16:41
-
-
Save sullivan-/8b81f41d9d6797f8f20c to your computer and use it in GitHub Desktop.
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
trait AuthRepo { | |
def create(auth: Author): AuthId | |
def retrieve(id: AuthId): Author | |
def update(auth: Author): Unit | |
def delete(auth: Author): Unit | |
} | |
class AuthRepoImpl extends AuthRepo { | |
def create(auth: Author) = println(s"create $auth") | |
def retrieve(id: AuthId) = { | |
println(s"retrieve $id") | |
new Author | |
} | |
def update(auth: Author) = println(s"update $auth") | |
def delete(auth: Author) = println(s"delete $auth") | |
} | |
trait AuthServ { | |
def create(auth: Author): AuthId | |
def retrieve(id: AuthId): Author | |
def update(auth: Author): Unit | |
def delete(auth: Author): Unit | |
} | |
class AuthServImpl(authRepo: AuthRepo) extends AuthServ { | |
def create(auth: Author) = authRepo.create(auth) | |
def retrieve(id: AuthId) = authRepo.retrieve(id) | |
def update(auth: Author) = authRepo.update(auth) | |
def delete(auth: Author) = authRepo.delete(auth) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment