Guest User

Untitled

a guest
Apr 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. object Paintings: UUIDTable() {
  2. ...
  3. val description = text("description").default("")
  4. ...
  5. }
  6.  
  7. class Painting(id: EntityID<UUID>) : UUIDEntity(id) {
  8. ...
  9.  
  10. var description by Paintings.description
  11.  
  12. ...
  13. }
  14.  
  15. class Painting(id: EntityID<UUID>) : UUIDEntity(id) {
  16. ...
  17.  
  18. var description by property<String>()
  19. fun descriptionProperty() = getProperty(Painting::description)
  20.  
  21. ...
  22. }
  23.  
  24. class Painting(id: EntityID<UUID>) : UUIDEntity(id) {
  25. ...
  26.  
  27. var description by Paintings.description notify property<String>()
  28. fun descriptionProperty() = getProperty(Painting::description)
  29.  
  30. ...
  31. }
  32.  
  33. open class Entity<ID:Comparable<ID>>(val id: EntityID<ID>) {
  34. ...
  35.  
  36. operator fun <T> Column<T>.getValue(o: Entity<ID>, desc: KProperty<*>): T =
  37. lookup()
  38.  
  39. operator fun <T> Column<T>.setValue(o: Entity<ID>, desc: KProperty<*>, value: T) {...}
  40.  
  41. //Global Extension instead of scoped to `Entity`
  42. infix fun <T> Column<T>.notify(fxProperty: PropertyDelegate<T>) {
  43. return DelegateWrapper(this,fxProperty)
  44. }
  45.  
  46. class DelegateWrapper<T>(val column: Column<T>, val fxProperty: PropertyDelegate<T>) {
  47.  
  48. operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
  49. return column.getValue(...) <-cannot resolve getValue
  50. }
  51.  
  52. operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String)
  53. {
  54. ...
  55. }
  56. }
Add Comment
Please, Sign In to add comment