ObjectUtils

Functions

Link copied to clipboard
fun getObjectOrNull(obj: Any, fieldName: String): Any?
fun getObjectOrNull(obj: Any, fieldName: String, clazz: Class<*>? = null): Any?

Get the field object by the name in the object.

Link copied to clipboard
fun <T> getObjectOrNullAs(obj: Any, fieldName: String): T?

Get the field object by the name in the object, and trying to cast to the T type.

Link copied to clipboard
fun getObjectOrNullUntilSuperclass(obj: Any, fieldName: String, untilSuperClass: Class<*>.() -> Boolean? = null): Any?

Get the field object by the name in the object.

Link copied to clipboard
fun <T> getObjectOrNullUntilSuperclassAs(obj: Any, fieldName: String, untilSuperClass: Class<*>.() -> Boolean? = null): T?

Get the field object by the name in the object, and trying to cast to the T type.

Link copied to clipboard
fun invokeMethod(obj: Any, methodName: String, returnType: Class<*>? = null, paramTypes: ParamTypes = paramTypes(), params: Params = params()): Any?

Invoke the object method

Link copied to clipboard
fun invokeMethodBestMatch(obj: Any, methodName: String, returnType: Class<*>? = null, vararg params: Any?): Any?

Invoke the object method(best match params)

Link copied to clipboard
fun setObject(obj: Any, fieldName: String, value: Any?)
fun setObject(obj: Any, fieldName: String, value: Any?, clazz: Class<*>? = null)

Set the field object by the name in the object.

Link copied to clipboard
fun setObjectUntilSuperclass(obj: Any, fieldName: String, value: Any?, untilSuperClass: Class<*>.() -> Boolean? = null)

Set the field object by the name in the object.