Skip to content

Instantly share code, notes, and snippets.

@darkfrog26
Created June 24, 2012 19:40
Show Gist options
  • Save darkfrog26/2984640 to your computer and use it in GitHub Desktop.
Save darkfrog26/2984640 to your computer and use it in GitHub Desktop.
trait Lazy[T <: Persistable] extends Function0[T]
case class LazyValue[T <: Persistable](id: util.UUID, collection: DatastoreCollection[T]) extends Lazy[T] {
private lazy val value = collection.byId(id).getOrElse(null)
def apply() = value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment