rattleshirt
07/06/2018, 8:25 AMCould not find accessor companyName
when using android:text="@{data.invoice.companyName}"
(kotlin v1.2.51) with abstract var companyName: String?
. In the kotlin bytecode I see a getCompanyName()
method but that doesn’t work eitherarekolek
07/06/2018, 8:31 AMdata.getInvoice()
that is chosen over data.invoice
and doesn't have the companyName
. That was the problem here https://stackoverflow.com/questions/32683129/android-databinding-error-could-not-find-accessorrattleshirt
07/06/2018, 9:14 AMgildor
07/06/2018, 9:15 AMrattleshirt
07/06/2018, 9:16 AMgildor
07/06/2018, 9:16 AMgetCompanyName()
rattleshirt
07/06/2018, 9:18 AMabstract class InvoiceType {
abstract var companyName: String?
}
interface AfterpayInvoice<T : InvoiceType> {
var invoice: T
}
data class Invoice(@PrimaryKey
var orderNumber: String,
override var companyName: String?
) : InvoiceType()
class InvoiceWithDetails : AfterpayInvoice<Invoice> {
@Embedded
override lateinit var invoice: Invoice
}
gildor
07/06/2018, 9:36 AMrattleshirt
07/06/2018, 9:37 AMinterface AfterpayInvoice<T : InvoiceType> {
var invoice: T
fun getterForInvoice() : InvoiceType
}
gildor
07/06/2018, 9:59 AMdata
class InvoiceSomeData : SomeData<InvoiceType>
rattleshirt
07/06/2018, 10:15 AMgildor
07/06/2018, 10:49 AM