This library aims to minimise the MVP setup boilerplate code to the minimum. Decorate your Contract interfaces, build, and extend the generated abstract classes. Your contract functions will be there, as well as all needed references. The MODEL and the VIEW will contain references to the PRESENTER, and the PRESENTER to both the MODEL and the VIEW. Enhance further by setting Base classes which will be extended by the generated abstract classes.
implementation 'com.izikode.izilib:contractor:0.1'
annotationProcessor 'com.izikode.izilib:contractor:0.1'
implementation 'com.izikode.izilib:contractor:0.1'
kapt 'com.izikode.izilib:contractor:0.1'
@Contract
interface MainContract {}
@Contract
interface MainContract {
@Contract.Model
interface Model {}
@Contract.View
interface View {}
@Contract.Presenter
interface Presenter {}
}
class MainPresenter : AbstractMainPresenter() {}
interface MainContract PLUS interface Model GENERATES AbstractMainModel
val model = MainModel()
val view = MainView()
val presenter = MainPresenter()
presenter.setup(model).setup(view)
model()
view()
presenter()
@Contract(target = "com.somepackage")
@Contract.Model(base = BaseModel::class)
interface Model
- Use javapoet for code generation
- Finilize logic and implementation for the Contractor class (possibly creating objects and setup automatically)
Copyright 2018 Fanie Veizis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.