Popularity
0.3
Growing
Activity
0.0
Stable
1
0
0

Description

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.

Programming language: Java
Tags: Kotlin     MVP     Android     Architecture     Android-library    

Contractor alternatives and similar packages

Based on the "Kotlin" category.
Alternatively, view Contractor alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Contractor or a related project?

Add another 'Kotlin' Package

README

Contractor

Annotate your MVP Contract interface to automatically generate your component classes

License Development Bintray

Premise

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.

Install

implementation 'com.izikode.izilib:contractor:0.1'
annotationProcessor 'com.izikode.izilib:contractor:0.1'
- or with kotlin
implementation 'com.izikode.izilib:contractor:0.1'
kapt 'com.izikode.izilib:contractor:0.1'

Sample usage

a. Create and decorate yout contract

@Contract
interface MainContract {}

b. Create and decorate your component interfaces

@Contract
interface MainContract {

    @Contract.Model
    interface Model {}

    @Contract.View
    interface View {}

    @Contract.Presenter
    interface Presenter {}

}

c. Write your functions and BUILD

d. Extend the generated classes for your final implementation

class MainPresenter : AbstractMainPresenter() {}
- Naming convention

interface MainContract PLUS interface Model GENERATES AbstractMainModel

e. Initialize the Objects and References

val model = MainModel()
val view = MainView()
val presenter = MainPresenter()

presenter.setup(model).setup(view)
- Access the references simply through

model() view() presenter()

f. Optionally, set a target build package

@Contract(target = "com.somepackage")

g. Optionally, have your components extend BASE classes

@Contract.Model(base = BaseModel::class)
interface Model

TODO

  • Use javapoet for code generation
  • Finilize logic and implementation for the Contractor class (possibly creating objects and setup automatically) ## Licence ```licence 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.


*Note that all licence references and agreements mentioned in the Contractor README section above are relevant to that project's source code only.