All Downloads are FREE. Search and download functionalities are using the official Maven repository.

run.smt.ktest.util.reflection.reflection.kt Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package run.smt.ktest.util.reflection

import kotlin.reflect.KClass

inline fun  Class<*>.canBeAssignedTo() = this canBeAssignedTo R::class

infix fun Class<*>.canBeAssignedTo(other: KClass<*>) = other.java.isAssignableFrom(this) || other.javaObjectType.isAssignableFrom(this)

inline fun  KClass<*>.canBeAssignedTo() = this canBeAssignedTo R::class

infix fun  KClass<*>.canBeAssignedTo(other: Class): Boolean {
  return other.isAssignableFrom(this.java)
      || other.isAssignableFrom(this.javaObjectType)
}

infix fun KClass<*>.canBeAssignedTo(other: KClass<*>): Boolean {
  return other.java.isAssignableFrom(this.java)
      || other.java.isAssignableFrom(this.javaObjectType)
      || other.javaObjectType.isAssignableFrom(this.java)
      || other.javaObjectType.isAssignableFrom(this.javaObjectType)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy