toStringGetter

Converts a Kotlin property to a string property getter.

This method validates that the property returns a String type and creates a PropertyGetter for accessing the property value.

Example usage:

class User(val name: String)

val user = User("John")
val nameGetter = User::name.toStringGetter()
val name = nameGetter.get(user) // Returns "John"

Return

a PropertyGetter that can retrieve the string value of this property

Parameters

T

the type of the object containing the property

Throws

if the property is not of type String