A property/method accessor library for the JVM, written in Kotlin

Related tags

Kotlin kotlin jvm
Overview

unlok - unlock your JVM

Build Maven Central

a property/method accessor library for the JVM, written in Kotlin.

how to import

you can import unlok from maven central just by adding it to your dependencies:

gradle

repositories {
    mavenCentral()
    
    // Koffee repository, an Unlok dependency
    maven("https://maven.hackery.site")
}

dependencies {
    implementation("me.xtrm:unlok:{VERSION}")
}

how to use

Note: you can see more examples in our tests source set.

accessing a field

() println(privatedName) val instance = DeclaringClass() // use `var` to modify the variable, even if it is final var index by DeclaringClass::class.field (ownerInstance = instance) index = 10 println(index) }">
class DeclaringClass {
    companion object {
        @JvmStatic
        private val privatedName: String = "John"
    }
    private val index: Int = 9
}

fun access() {
    // name infered from delegation
    val privatedName by DeclaringClass::class.field<String>()
    println(privatedName)
    
    val instance = DeclaringClass()
    
    // use `var` to modify the variable, even if it is final
    var index by DeclaringClass::class.field<Int>(ownerInstance = instance)
    index = 10
    println(index)
}

accessing a method

() println(getState()) val instance = DeclaringClass() val isGaming by DeclaringClass::class.method (ownerInstance = instance) println(isGaming(true)) }">
class DeclaringClass {
    companion object {
        @JvmStatic
        private fun getState() = "sleeping"
    }
    private fun isGaming(wearingSocks: Boolean) = !wearingSocks
}

fun access() {
    // name infered from delegation
    val getState by DeclaringClass::class.method<String>()
    println(getState())
    
    val instance = DeclaringClass()
    val isGaming by DeclaringClass::class.method<Boolean>(ownerInstance = instance)
    println(isGaming(true))
}

troubleshooting

if you ever encounter any problem related to this project, you can open an issue describing what the problem is. please, be as precise as you can, so that we can help you asap. we are most likely to close the issue if it is not related to our work.

contributing

you can contribute by forking the repository, making your changes and creating a new pull request describing what you changed, why and how.

licensing

this project is under the ISC license.

You might also like...
Port immer for kotlin/jvm
Port immer for kotlin/jvm

1. kimmer Port https://github.com/immerjs/immer for kotlin/jvm (requires kotlin 1.5+). Immer is the winner of the "Breakthrough of the year" React ope

Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)
Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)

storyblok-mp-SDK-blog ... a showcase of using the Storyblok Kotlin Multiplatform Client to build a blog application (Android, JVM) What's included ๐Ÿš€

Kotlin/JVM compensated summation of Double sequences to calculate sum, mean, standard deviation

precise Implements compensated summation for sequences of Double. Reduces rounding errors associated with limited precision of floating-point numbers.

BlurHash support for iOS, Android and JVM via Kotlin Multiplatform
BlurHash support for iOS, Android and JVM via Kotlin Multiplatform

blurhash A Kotlin Multiplatform library to use blurhash in your Android App, iOS / Mac App & JVM Backend. Android iOS JVM Why? If you've tried using b

Kotlin/JVM Lambda example

kotlin-lambda-example-jvm Kotlin Lambda example on JVM contains four CDK stacks of Kotlin Lambda on JVM: JVM on x86, JVM on Arm64, JVM with C1 compile

๐Ÿ”ด A non-deterministic finite-state machine for Android & JVM that won't let you down
๐Ÿ”ด A non-deterministic finite-state machine for Android & JVM that won't let you down

HAL is a non-deterministic finite-state machine for Android & JVM built with Coroutines StateFlow and LiveData. Why non-deterministic? Because in a no

:blowfish: An Android & JVM key-value storage powered by Protobuf and Coroutines

PufferDB PufferDB is a โšก key-value storage powered by Protocol Buffers (aka Protobuf) and Coroutines. The purpose of this library is to provide an eff

A injection minecraft cheat using jvm attach api

Luminous A injection minecraft cheat using jvm attach api Website: https://lumi.getfdp.today Build We used a thing called Wrapper to make development

Yet Another Native Loader for the JVM.

yanl - yet another native loader Yet another Native library extractor/loader for the JVM, written in Kotlin. why other libraries simply don't fit my n

Releases(v0.3.1)
Owner
xtrm
memes & dev // professional skid. prefered pronoun: dumbass
xtrm
Backing property explained - youtube video link in documnetation

backing property => Kotlin => Getter Setter and Backing Property Screenshot Inside android studio open a file press Alt+Shift+A and search for kotlin

Vishnu Sunilkumar 0 Nov 3, 2021
Transform java callback to kotlin suspend method.

Callback2Coroutines Transform Java callback to coroutines suspend method. ๅฐ†ไผ ็ปŸJava callback ๆ–นๆณ•่ฝฌๆขไธบkotlinไธญ็š„suspendๆ–นๆณ•ใ€‚ ๆŽฅๅ…ฅๆŒ‡ๅ— ๆ น็›ฎๅฝ•ไธ‹ๅŠ ๅ…ฅjatpack็š„repository๏ผš allp

RainFool 14 May 25, 2021
Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Zipline This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deploymen

Cash App 1.5k Dec 30, 2022
๐ŸšŸ Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru ?? Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

Noel 13 Dec 16, 2022
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
๐ŸŽ‘ Up to date IANA timezone database library for Kotlin (JVM, JS, Native)

?? IANA Timezone Library for Kotlin Multiplatform Up to date IANA timezone database library for Kotlin (JVM, JS, Native) Usage import org.noelware.ian

Noelware 3 Jun 18, 2022
Lightweight compiler plugin intended for Kotlin/JVM library development and symbol visibility control.

Restrikt A Kotlin/JVM compiler plugin to restrict symbols access, from external project sources. This plugin offers two ways to hide symbols: An autom

Lorris Creantor 18 Nov 24, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Practical Kotlin Multiplatform on the Web ๋ณธ ์ €์žฅ์†Œ๋Š” ์ฝ”ํ‹€๋ฆฐ ๋ฉ€ํ‹ฐํ”Œ๋žซํผ ๊ธฐ๋ฐ˜ ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์›Œํฌ์ˆ(๊ฐ•์ขŒ)์„ ์œ„ํ•ด ์ž‘์„ฑ๋œ ํ…œํ”Œ๋ฆฟ ํ”„๋กœ์ ํŠธ๊ฐ€ ์žˆ๋Š” ๊ณณ์ž…๋‹ˆ๋‹ค. ์›Œํฌ์ˆ ๊ณผ์ •์—์„œ ์ฝ”ํ‹€๋ฆฐ ๋ฉ€ํ‹ฐํ”Œ๋žซํผ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ”„๋ก ํŠธ์—”๋“œ(front-end)๋Š” Ko

SpringRunner 14 Nov 5, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Building a Full Stack Web App with Kotlin Multiplatform ๋ณธ ์ €์žฅ์†Œ๋Š” INFCON 2022์—์„œ ์ฝ”ํ‹€๋ฆฐ ๋ฉ€ํ‹ฐํ”Œ๋žซํผ ๊ธฐ๋ฐ˜ ์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ ํ•ธ์ฆˆ์˜จ๋žฉ์„ ์œ„ํ•ด ์ž‘์„ฑ๋œ ํ…œํ”Œ๋ฆฟ ํ”„๋กœ์ ํŠธ๊ฐ€ ์žˆ๋Š” ๊ณณ์ž…๋‹ˆ๋‹ค. ํ•ธ์ฆˆ์˜จ ๊ณผ์ •์—์„œ ์ฝ”ํ‹€๋ฆฐ ๋ฉ€ํ‹ฐํ”Œ๋žซํผ์„

Arawn Park 19 Sep 8, 2022
Yaspeller-kt - Asynchronous Yandex.Speller API wrapper for Kotlin/JVM.

yaspeller-kt Asynchronous Yandex.Speller API wrapper for Kotlin/JVM. Installation repositories { maven { url 'https://jitpack.io' }

Mikhail Koshkin 6 Jun 27, 2022