Skip to content

i-petro/AndroidKotlinCore

Repository files navigation

AndroidKotlinCore Awesome

MVP implementation

Features:

Sample:

See project sample and Wiki

Entity converters

Features:

  • support for converting models of different levels of abstraction (See Wiki)
  • support for collections converting (See Wiki)
  • support for interfaces converting (See Wiki)

Sample:

    interface User {
        val name: String
        val password: String
    }

    data class UserRest(val name: String, val password: String)
    data class UserDb(val name: String, val password: String) 
    data class UserImpl(override val name: String, override val password: String): User

    val context: ConvertersContext = ConvertersContextImpl()
    context.registerConverter { input: User -> UserDb(input.name, input.password) }
    context.registerConverter { input: UserRest -> UserImpl(input.name, input.password) }

    val userDb = UserDb("Name1", "Password1")
    val userRest = UserRest("Name1", "Password1")
    val userImpl = UserImpl("Name1", "Password1")

    val convertedRestToImpl: User = context.convert(userRest)
    val convertedImplToDb: UserDb = context.convert(userImpl)

    assertEquals(userImpl, convertedRestToImpl)
    assertEquals(userDb, convertedImplToDb)

Installation

You can use any of this dependencies

Module Version Dependency
MVP core implementation Download 'com.androidkotlincore:mvp:x.y.z'
MVP extensions for RxJava 1 Download 'com.androidkotlincore:mvp-rx1:x.y.z'
MVP extensions for RxJava 2 Download 'com.androidkotlincore:mvp-rx2:x.y.z'
Entity converter Download 'com.androidkotlincore:entityconverter:x.y.z'

or just download zip and import module to be able to modify the sources

License


MIT License

Copyright (c) 2018 i-petro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

AndroidKotlinCore

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published