Skip to content

Instantly share code, notes, and snippets.

@timvw
Created February 7, 2019 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvw/0e2d106492f1787c92dbaac620c0f3fd to your computer and use it in GitHub Desktop.
Save timvw/0e2d106492f1787c92dbaac620c0f3fd to your computer and use it in GitHub Desktop.
Demonstrating cake pattern
trait IHaveLakeName {
def lakeName: String
}
trait IHaveStreamName {
def streamName: String
}
trait IHaveLakeAndStreamName extends IHaveLakeName with IHaveStreamName
trait CheckpointNameFromLakeAndStream extends HasCheckpointName { self: IHaveLakeName with IHaveStreamName =>
override def checkpointName: String = s"${lakeName}_${streamName}"
}
class MyPuddle extends IHaveLakeName with IHaveStreamName with CheckpointNameFromLakeAndStream {
override def lakeName: String = "awesome"
override def streamName: String = "data"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment