{"id":17182189,"url":"https://github.com/wuseal/kotlin-reflect-tools-for-android","last_synced_at":"2025-08-24T13:19:56.759Z","repository":{"id":93273732,"uuid":"110815215","full_name":"wuseal/Kotlin-Reflect-Tools-For-Android","owner":"wuseal","description":"Kotlin reflect tools for Android","archived":false,"fork":false,"pushed_at":"2018-06-03T06:49:18.000Z","size":154,"stargazers_count":85,"open_issues_count":0,"forks_count":26,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T09:03:23.119Z","etag":null,"topics":["android","kotlin","kotlin-reflect","reflect"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wuseal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-11-15T09:49:58.000Z","updated_at":"2022-11-29T16:53:01.000Z","dependencies_parsed_at":"2023-03-06T20:15:29.906Z","dependency_job_id":null,"html_url":"https://github.com/wuseal/Kotlin-Reflect-Tools-For-Android","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/wuseal/Kotlin-Reflect-Tools-For-Android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKotlin-Reflect-Tools-For-Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKotlin-Reflect-Tools-For-Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKotlin-Reflect-Tools-For-Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKotlin-Reflect-Tools-For-Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wuseal","download_url":"https://codeload.github.com/wuseal/Kotlin-Reflect-Tools-For-Android/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wuseal%2FKotlin-Reflect-Tools-For-Android/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271873507,"owners_count":24837273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","kotlin","kotlin-reflect","reflect"],"created_at":"2024-10-15T00:36:16.802Z","updated_at":"2025-08-24T13:19:56.712Z","avatar_url":"https://github.com/wuseal.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Bintray](https://img.shields.io/bintray/v/wusealking/maven/wu.seal.android.kotlinreflecttools.svg)](https://bintray.com/wusealking/maven/wu.seal.android.kotlinreflecttools#)\n[![GitHub stars](https://img.shields.io/github/stars/wuseal/Kotlin-Reflect-Tools-For-Android.svg?style=social\u0026label=Stars\u0026style=plastic)](https://github.com/wuseal/Kotlin-Reflect-Tools-For-Android/stargazers)\n[![license](https://img.shields.io/github/license/wuseal/Kotlin-Reflect-Tools-For-Android.svg)](https://github.com/wuseal/Kotlin-Reflect-Tools-For-Android/blob/master/LICENSE)\n# Kotlin-Reflect-Tools-For-Android\nKotlin reflect tools for Android\n\nRelated Project: [Kotlin-Reflect-Tools-For-JVM](https://github.com/wuseal/Kotlin-Reflect-Tools-For-JVM)\n\n## OverView\nThis is a tool library for Kotlin to use java reflect APIs in Kotlin simply method on android platform. It can modify or read the top level private visible property value in Kotlin way.\n \n ## Usage\n * Add jcenter repository in your moduel build gradle:\n   ```groovy\n    repositories {\n         jcenter()\n    }\n    ```\n    \n * Apply library in dependency config:\n \n    ```groovy\n       compile 'wu.seal:kotlin-reflect-tools-for-android:1.1.2'\n    ```\n    \n## APIs\n\n|Method         | Describe          |\n|:------------- |:-------------|\n|Any.getPropertyValue(propertyName: String): Any?|get object property value by name|\n|Any.changePropertyValue(propertyName: String, newValue: Any?) |change object property value by name|\n|Any.changePropertyValueByPropertyReference(kProperty: KProperty\u003cR\u003e, newValue: Any?)|change object property value by property reference|\n|Any.invokeMethod(methodName: String, vararg args: Any?): Any?|invoke a method through object by method name|\n|\u003cR\u003e KProperty\u003cR\u003e.changeValue(thisObj: Any, newValue: Any?)|change current this property valuev|\n|\u003cR\u003e KProperty\u003cR\u003e.packageLevelGetPropertyValueByName(otherPropertyName: String): Any? |get other package level property value by other package level property name which is in the same kotlin file|\n|\u003cR\u003e KFunction\u003cR\u003e.packageLevelGetPropertyValueByName(otherPropertyName: String): Any?|get other package level property value by other package level property name which is in the same kotlin file|\n|\u003cR\u003e KProperty\u003cR\u003e.packageLevelChangePropertyValue(newValue: Any?)|change package level property value|\n|\u003cR\u003e KProperty\u003cR\u003e.packageLevelChangeOtherPropertyValueByName(otherPropertyName: String, newValue: Any?)|change other package level property value by other package level property name which is in the same kotlin file|\n|\u003cR\u003e KFunction\u003cR\u003e.packageLevelChangeOtherPropertyValueByName(otherPropertyName: String, newValue: Any?)|change other package level property value by other package level property name which is in the same kotlin file|\n|\u003cR\u003e KProperty\u003cR\u003e.packageLevelInvokeMethodByName(methodName: String, vararg args: Any?): Any? |invoke package level method by name which is in the same kotlin file|\n|\u003cR\u003e KFunction\u003cR\u003e.packageLevelInvokeMethodByName(methodName: String, vararg args: Any?): Any?|invoke package level method by name which is in the same kotlin file|\n \nAll method don't care what the property or method visibility it is \n\n## Demo\nFor example a Kotlin file like this:\n```kotlin\n\nval topName = \"topSeal\"\nval topNameWu = \"topSealWu\"\nprivate val topAge = 666\n\nprivate fun gotIt() = true\n\nfun funDoubleAge(age: Int): Int {\n    return age * 2\n}\n\nclass TestDemo {\n    private val name = \"seal\"\n    val age = 28\n\n    private fun isMan(): Boolean {\n        return true\n    }\n}\n```\nThen we could do these :\n```kotlin\n   \n    @Test\n    fun getPropertyValue() {\n        val demo = TestDemo()\n        val nameValue = demo.getPropertyValue(\"name\")\n        nameValue.should.be.equal(\"seal\")\n    }\n\n    @Test\n    fun changePropertyValue() {\n        val demo = TestDemo()\n        val originValue = demo.age\n        demo.changePropertyValue(\"age\", 100)\n        val nowValue = demo.age\n        originValue.should.not.equal(nowValue)\n        nowValue.should.be.equal(100)\n    }\n    \n    @Test\n    fun changeValue() {\n        val demo = TestDemo()\n        demo::age.changeValue(demo, 100)\n        demo.age.should.be.equal(100)\n    }\n\n    @Test\n    fun packageLevelGetPropertyValueByName() {\n        val topAge = ::topNameWu.packageLevelGetPropertyValueByName(\"topAge\")\n        topAge.should.be.equal(666)\n    }\n\n    @Test\n    fun packageLevelInvokeMethodByName() {\n        val methodResult = ::topName.packageLevelInvokeMethodByName(\"gotIt\") as Boolean\n        methodResult.should.be.`true`\n    }\n\n```\n\nTo see more usage cases ,you can have a look at the AndroidTest case in project.\n\n## Others\n* Welcome to raise any issue.\n* Welcome to push a pull request \n\n\n## Find me useful ? :heart:\n* Support me by clicking the :star: button on the upper right of this page. :v:\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuseal%2Fkotlin-reflect-tools-for-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwuseal%2Fkotlin-reflect-tools-for-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwuseal%2Fkotlin-reflect-tools-for-android/lists"}