GenContext

trait GenContext[T <: Txn[T]] extends Disposable[T]

Context for rendering generated objects.

Companion
object
trait Disposable[T]
class Object
trait Matchable
class Any

Value members

Abstract methods

def acquire[A <: Disposable[T]](obj: Obj[T])(init: => A)(implicit tx: T): A

Acquires a resource associated with an object. The resource is stored under the key obj.id, and an internal use count is maintained, calling dispose on the resource if the count goes back to zero.

Acquires a resource associated with an object. The resource is stored under the key obj.id, and an internal use count is maintained, calling dispose on the resource if the count goes back to zero.

Type Params
A

the type of resource which must be a Disposable

Value Params
init

the function that produces the resource if it was not yet in the cache

obj

the object used as a look-up key

Returns

the resource, either already found in the cache or newly produced

def get[A](obj: Obj[T])(implicit tx: T): Option[A]

Attempts to find a resource associated with an object.

Attempts to find a resource associated with an object.

Type Params
A

the type of resource

Value Params
obj

the object used as a look-up key

Returns

the resource, if it was found in the cache, or None

def release(obj: Obj[T])(implicit tx: T): Unit

Releases a resource associated with an object. This decreases the use count of the resource, and calls dispose on it if the count goes back to zero.

Releases a resource associated with an object. This decreases the use count of the resource, and calls dispose on it if the count goes back to zero.

Value Params
obj

the object used as a look-up key

Inherited methods

def dispose()(implicit tx: T): Unit
Inherited from
Disposable

Implicits

Implicits

implicit
def cursor: Cursor[T]
implicit
def workspace: Workspace[T]