Session

trait Session extends SessionImpl with AutoCloseable

Session manages injected objects (e.g., Singleton)

Companion
object
trait AutoCloseable
trait SessionImpl
class Object
trait Matchable
class Any

Value members

Abstract methods

Reference to the design used for creating this session.

Reference to the design used for creating this session.

def get[A](surface: Surface)(implicit sourceCode: SourceCode): A

Internal method for building an instance of type A. This method does not inject the session to A at first hand.

Internal method for building an instance of type A. This method does not inject the session to A at first hand.

def getInstanceOf(surface: Surface)(implicit sourceCode: SourceCode): Any
def getOrElse[A](surface: Surface, traitInstanceFactory: => A)(implicit sourceCode: SourceCode): A

Internal method for building an instance of type A, or if no binding is found, use the given trait instance factory

Internal method for building an instance of type A, or if no binding is found, use the given trait instance factory

Get the object LifeCycleManager of this session.

Get the object LifeCycleManager of this session.

def name: String

Name of the session (default: object hash code)

Name of the session (default: object hash code)

def newChildSession(d: Design, inheritParentDesignOptions: Boolean): Session

Create a child session with an additional design. The created session has its own singleton holder and a lifecycle manager.

Create a child session with an additional design. The created session has its own singleton holder and a lifecycle manager.

  • Child sessions tries to delegate the object binding to the parent (or ancestor) session if no corresponding binding is defined in the child design.
  • If the parent and ancestors ve no binding for a given type, it will creates a new object in the child session.
  • If the parent or an ancestor session already initialized a target binding, lifecycle hooks for that binding will not be called in the child session.
Value Params
d

Additional design for child session

inheritParentDesignOptions

if true (default) use the same design options (e.g., production mode, life cycle logging) with the parent design

Create a child session with an additional design. The created session shares the same singleton holder and the lifecycle manager with this session.

Create a child session with an additional design. The created session shares the same singleton holder and the lifecycle manager with this session.

def sessionId: Long

Id of the sesion (= object hash id)

Id of the sesion (= object hash id)

Concrete methods

override def close(): Unit
Definition Classes
AutoCloseable
def shutdown: Unit
def start[U](body: => U): U
def start: Unit
def withChildSession[U](d: Design)(body: Session => U): U

Create a child session and execute the body part. The created session has its own singleton holder and lifecycle manager.

Create a child session and execute the body part. The created session has its own singleton holder and lifecycle manager.

Value Params
d

Additional design for child session.

Inherited methods

inline def build[A]: A

Build an instance of A. In general this method is necessary only when creating an entry point of your application. When feasible avoid using this method so that Airframe can inject objects where bind[X] is used.

Build an instance of A. In general this method is necessary only when creating an entry point of your application. When feasible avoid using this method so that Airframe can inject objects where bind[X] is used.

Returns

object

Inherited from
SessionImpl
def register[A](instance: A): Unit

Register an instance to the session to control the life cycle of the object under this session.

Register an instance to the session to control the life cycle of the object under this session.

Inherited from
SessionImpl