You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can we use this library with kotlin("multiplatform") plugin (build.gradle.kts)?
Can we get the qualifiedName or the package of a class with this library?
For example, I've seen that we can do something like:
@JsName("_")
external val `_`: dynamic
fun checkAndReturnPackage(package_: String, class_: KClass<*>): String {
if (
class_.js.name
=== eval("get_js(Kotlin.getKClassFromExpression(_.$package_.${class_.simpleName})).name")
) {
return package_
}
throw IllegalArgumentException(
"""
The package $package_ isn't the correct package for the class $class_.
"""
)
}
fun checkExamplePackageAndReturnIt(): String {
val expectedPackage = "com.my.package.js"
if (
Example::class.js.name
=== `_`.com.my.package.js.Example::class.js.name
) {
return expectedPackage
}
throw IllegalArgumentException(
"""
The "$expectedPackage" isn't the correct package for the class "${Example::class.simpleName}".
"""
)
}
but I cannot really get the js package yet, so I was wondering if we can do something like this.
The text was updated successfully, but these errors were encountered:
Id love an answer to this one as well, seems a little sad that JetBrains haven't released a full reflection API as yet, one of our modules really needs access to class members
Danilo-Araujo-Silva
changed the title
How to the package name or the qualified name of a class?
How to get the package name or the qualified name of a class?
May 9, 2019
Can we use this library with
kotlin("multiplatform")
plugin (build.gradle.kts
)?Can we get the
qualifiedName
or thepackage
of a class with this library?For example, I've seen that we can do something like:
but I cannot really get the js package yet, so I was wondering if we can do something like this.
The text was updated successfully, but these errors were encountered: