gh-pages / com.nextfaze.devfun.inject / Constructable

Constructable

@Target([AnnotationTarget.CLASS]) annotation class Constructable (source)

Tag to allow classes to be instantiated when no other InstanceProvider was able to provide the class.

The class must have only one constructor. Any arguments to the constructor will be injected as normal.

In general this should not be used (you should be using your own dependency injection framework). However for quick-n-dirty uses this can make life a bit easier (e.g. function transformers which are debug only anyway).

Note: inner classes will work as long as the outer class can be resolved/injected..

Types annotated with @javax.inject.Singleton will only be created once.

Parameters

singleton - If true then a single shared instance will be constructed. Be careful when using this on inner classes as it will hold a reference to its outer class. i.e. Only use this if the outer class is an object/singleton.

See Also

FunctionTransformer

Constructors

Name Summary
<init> Constructable(singleton: Boolean = false)
Tag to allow classes to be instantiated when no other InstanceProvider was able to provide the class.

Properties

Name Summary
singleton val singleton: Boolean
If true then a single shared instance will be constructed. Be careful when using this on inner classes as it will hold a reference to its outer class. i.e. Only use this if the outer class is an object/singleton.