Contractor - Annotate your MVP Contract interface to automatically generate your component classes

Related tags

Kotlin Contractor
Overview

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

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.
You might also like...
A pure-Kotlin library for bots to interface with Revolt

RevoltKt A pure-Kotlin library for bots to interface with Revolt Sample Usage import me.maya.revolt.defaultClientBuilder import me.maya.revolt.events.

A simplified interface for interacting with in-memory cache implementations on the JVM

This library provides a simplified interface for interacting with in-memory cache implementations on the JVM. Think: "SLF4J but for caching"

EightyTwenty is life planner application with beautiful user interface.

EightyTwenty EightyTwenty is life planner application with beautiful user interface. Version 0.0.1 Add notes Add categories Add notes with image Move

Runtime Mobile Security (RMS) 📱🔥  - is a powerful web interface that helps you to manipulate Android and iOS Apps at Runtime
Runtime Mobile Security (RMS) 📱🔥 - is a powerful web interface that helps you to manipulate Android and iOS Apps at Runtime

Runtime Mobile Security (RMS) 📱 🔥 by @mobilesecurity_ Runtime Mobile Security (RMS), powered by FRIDA, is a powerful web interface that helps you to

Auto-generate the fastest possible Parcelable implementations for Java and Kotlin

This project is deprecated It will still be maintained, but no new features will be added. Please use Parcelize, as it is the official way of generati

This is a Kotlin multiplatform template project used to generate and deploy a natively compiled AWS lambda function using the custom runtime.
This is a Kotlin multiplatform template project used to generate and deploy a natively compiled AWS lambda function using the custom runtime.

Overview This is a Kotlin multiplatform template project used to generate and deploy a natively compiled AWS Lambda function using a custom runtime. U

Koin Annotations - help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you

The goal of Koin Annotations project is to help declare Koin definition in a very fast and intuitive way, and generate all underlying Koin DSL for you. The goal is to help developer experience to scale and go fast 🚀 , thanks to Kotlin Compilers.

A Gradle plugin for Kotlin Multiplatform projects that generate a XCFramework for Apple targets or a FatFramework for iOS targets, and manages the publishing process in a CocoaPod Repository.

KMP Framework Bundler KMP Framework Bundler is a Gradle plugin for Kotlin Multiplatform projects that generate a XCFramework for Apple targets or a Fa

Clay is an Android library project that provides image trimming which is originally an UI component of LINE Creators Studio
Clay is an Android library project that provides image trimming which is originally an UI component of LINE Creators Studio

Clay Clay is an Android library project that provides image trimming. Fully written in Kotlin, Clay is originally a UI component of LINE Creators Stud

Owner
Fanis Veizis
Android headbanger
Fanis Veizis
[prototype] Generate TypeScript interfaces from Kotlin classes

Kotlinx Serialization TypeScript Generator Kotlinx Serialization TypeScript Generator creates TypeScript interfaces from Kotlinx Serialization classes

null 17 Dec 18, 2022
Android RecyclerView Adapter with nested items & expand/contract functionality

AccordionRecycler Android RecyclerView Adapter with nested items & expand/contract functionality With AccordionRecycler you can easily create awesome

Fanis Veizis 17 Aug 18, 2022
Automatically empty the trash in all of your Plex libraries

Plex Auto Trash Automatically empty the trash in all of your Plex libraries. If you disable automatic trash emptying (and you probably should) trash s

Jake Wharton 25 Aug 11, 2022
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

Robert 20 Nov 9, 2021
This program will read from your android application string.xml file and generate translated strings.xml files in your preferred languages using google sheet.

Localize your application content This program will read from your application string.xml file and generate translated strings.xml files in your prefe

DhiWise 4 Jul 29, 2022
Parallax scrolling either by offset or automatically.

ParallaxScrollingView Parallax Scrolling View. automatic scrolling with different speeds minimal integration gpu accelerated supports vector drawables

Jan Rabe 100 Nov 21, 2022
This library is a set of simple wrapper classes that are aimed to help you easily access android device information.

SysInfo Simple, single class wrapper to get device information from an android device. This library provides an easy way to access all the device info

Klejvi Kapaj 7 Dec 27, 2022
Clean MVVM with eliminating the usage of context from view models by introducing hilt for DI and sealed classes for displaying Errors in views using shared flows (one time event), and Stateflow for data

Clean ViewModel with Sealed Classes Following are the purposes of this repo Showing how you can remove the need of context in ViewModels. I. By using

Kashif Mehmood 22 Oct 26, 2022
💫 A Gradle Plugin to generate your networking code from Swagger

Swagger Gradle Codegen A Gradle plugin to generate networking code from a Swagger spec file. This plugin wraps swagger-codegen, and exposes a configur

Yelp.com 399 Nov 28, 2022
Interface for SAMANA-User

SAMANA-USER Table Of Contents Introduction Selected Theme Title Usage Feature Demo Youtube Layers Tech Stack Mad Scoreboard Introduction Samana projec

SAMANA 3 Oct 7, 2021