Details
-
Type:
Improvement
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: Waiting for Triage
-
Component/s: Core
-
Labels:
-
Last commented by a User:true
Description
It would be really helpful for my current project if BeanWrapper would support resolving Kotlin Extension Properties.
Please see the following example for demonstration purpose:
data class Person(val firstName: String, val lastName: String) val Person.fullName: String get() = "$firstName $lastName" ... val person = Person("Peter", "Parker") val beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(subject) assertEquals("Peter Parker", beanWrapper.getPropertyValue("fullName"))
Extension Properties are a great way to structure large domain models without cluttering classes with usecase specific domain logic. We currently migrate large parts of our Java domain models to Kotlin. Since we use BeanWrapper for a few major features of our application, we currently have to work around Kotlin extension properties by using reflection to access those properties in case beanWrapper.isReadableProperty yields false.
It would be really helpful if BeanWrapper would support this out of the box, e.g. by passing packages including Kotlin extensions as a second optional argument:
val beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(subject, extensionPackages)