get Object Or Null
Get the field object by the name in the object.
Return
field object or null
Parameters
obj
object
field Name
field name
Throws
if the field is not found
Samples
import com.github.kyuubiran.ezxhelper.ObjectUtils
fun main() {
//sampleStart
val obj = object {
val field = "Hello World"
}
val field = ObjectUtils.getObjectOrNull(obj, "field")
println(field)
//sampleEnd
}
Get the field object by the name in the object.
Return
field object or null
Parameters
obj
object
field Name
field name
clazz
class where the field is declared (optional, defaults to the class of 'obj')
Throws
if the field is not found
Samples
import com.github.kyuubiran.ezxhelper.ObjectUtils
fun main() {
//sampleStart
val obj = object {
val field = "Hello World"
}
val field = ObjectUtils.getObjectOrNull(obj, "field")
println(field)
//sampleEnd
}