-
Notifications
You must be signed in to change notification settings - Fork 1
java_signatures
The entire library works on the principle of code generation, an annotation processor. In order for the program to be assembled correctly, it is necessary to correctly create DI components, as well as adhere to certain signatures for various methods and classes.
The stone library apperates the basic entities
- DI component
- Module
- Dependencies
A class that describes the rules for creating objects in DI, as well as caching rules, without the need to directly manage caching.
Identified by the @Module annotation
All methods in a mod must return some kind of object.
There can be 2 types of methods in a module
-
Providing objects. These are regular methods, or those marked with the
@Provideannotation. The method must have arguments only of identifiers described in the component. For example,@Component(identifiers = {ScreenId.class, LoginId.class}), or objects already provided in the component. -
Binding of objects. Methods marked with the
@BindInstanceannotation. The methods describe the binding and caching of objects in the DI component. The object must be returned. They can also have one argument, the type of which is equal to the type of the returned object.
Classes describing the dependencies used in the DI component.
Contains provisioning methods.
Identified by the annotation @Dependencies
All methods must return some kind of object.
A generic DI class, denoted by the @Component annotation.
May contain methods
-
Providing a module or dependency. A simple method with no arguments or annotations that returns an object denoted by the
@Moduleor@Dependenciesannotation. -
Initialization method. A method denoted by the
@Initannotation. Returns nothing and must have module or dependency type arguments. There should be no other method annotations. -
Extension method. A method denoted by the
@ExtendOfannotation. Must have only one parent component argument and return nothing. There should be no other method annotations. -
Providing an object. An unannotated method that returns an object provided in one of the component's modules or dependencies. The arguments can accept the specified identifiers
@Component(identifiers = {ScreenId.class}). The return type must not be a primitive, an object implementation of a primitive, or an identifier. -
Binding method. Method with the
@BindInstanceannotation. The method must have only one binding object argument and return it. If the method does not return anything, then the method will try to bind the object in one of the modules where this binding is described. The return type must not be a primitive, an object implementation of a primitive, or an identifier. -
GC method. A method designated by one of the GC scope annotations, for example
@GcAllScope. The method must not have any annotations other than specifying GC scopes. Also return nothing and have no arguments. -
Method for changing cache type. A method designated by one of the GC scope annotations, as well as the
@SwitchCacheannotation. The method must not contain any other annotations, nor must it return anything or have any arguments. -
Injection method. A method that does not return anything and has an object for injection in its arguments. Can also take a child object of
StoneLifeCycleOwnerand an identifier as arguments. -
Variable injection protection method. A method with the
@ProtectInjectedannotation and no other anations. Must have only one argument and return nothing.