The type
keyword defines some abstract type. A specific DatabaseComponent
subclass (a concrete implementation) can implement this type as a concrete class.
The >:
and <:
are type bounds on the abstract type Session
. The ones in the example mean that an abstract type member Session
is null
-able and it is a subtype of some other type SessionDef
.
The upper bound SessionDef
(<:
) is here because:
- an implementation of
DatabaseComponent
can only defineSession
types such that they are subtypes ofSessionDef
- if some method in
DatabaseComponent
happens to return an object of typeSession
, you won't know its exact implementation, but you will know that you can call whatever method exists inSessionDef
on it
The lower bound Null
(>:
) is here because it allows you to initialize variables of type Session
with a null
value.
Read more about abstract type members here and type bounds here.