API: jadi¶
-
jadi.
interface
(cls)[source]¶ Marks the decorated class as an abstract interface.
Injects following classmethods:
-
.
all
(context)¶ Returns a list of instances of each component in the
context
implementing this@interface
Parameters: context ( Context
) – context to look inReturns: list( cls
)
-
.
any
(context)¶ Returns the first suitable instance implementing this
@interface
or raisesNoImplementationError
if none is available.Parameters: context ( Context
) – context to look inReturns: cls
-
.
classes
()¶ Returns a list of classes implementing this
@interface
Returns: list(class)
-
-
jadi.
component
(iface)[source]¶ Marks the decorated class as a component implementing the given
iface
Parameters: iface ( interface()
) – the interface to implement
-
jadi.
service
(cls)[source]¶ Marks the decorated class as a singleton
service
.Injects following classmethods:
-
class
jadi.
Context
(parent=None)[source]¶ An IoC container for
interface()
s,service()
s andcomponent()
sParameters: parent ( Context
) – a parent context