#74 prototype: GenericObject

Offen
vor 4 Jahren geöffnet von ranides · 4 Kommentare
ranides kommentierte vor 4 Jahren

Something similar to GenericMap or especially PrototypeMap but supports situation where multiple keys points to the same property (by identity). For example, row cell from excel row can access in 3 ways:

  • by cell index: get(4)
  • by cell name: get("D")
  • by cell header name: get("First name")
Something similar to `GenericMap` or especially `PrototypeMap` but supports situation where multiple keys points to the same property (by identity). For example, row cell from excel row can access in 3 ways: - by cell index: get(4) - by cell name: get("D") - by cell header name: get("First name")
ranides kommentierte vor 3 Jahren
Besitzer

GenericMap and GenericKey isn't useful in our situation. Maybe we can use PrototypeMap with some "tricky" key wrapper? That means: we can have Map which simply maps "public keys" into some uid and PrototypeMap which stores mappings {uid => value}.

GenericMap and GenericKey isn't useful in our situation. Maybe we can use PrototypeMap with some "tricky" key wrapper? That means: we can have Map which simply maps "public keys" into some uid and PrototypeMap which stores mappings {uid => value}.
ranides kommentierte vor 3 Jahren
Besitzer

The fact that PrototypeMap is a class is a problem more and more. Maybe we should split it into PrototypeMap interface and OpenPrototypeMap? Or add extension points? For example for optional key mapping before get/put operation?

The fact that PrototypeMap is a class is a problem more and more. Maybe we should split it into PrototypeMap interface and OpenPrototypeMap? Or add extension points? For example for optional key mapping before get/put operation?
ranides kommentierte vor 3 Jahren
Besitzer

To be honest, we already did that inside ObservablePrototypeMap. We should follow the pattern and just use internally our own map implementation for "declared" field.

To be honest, we already did that inside ObservablePrototypeMap. We should follow the pattern and just use internally our own map implementation for "declared" field.
ranides kommentierte vor 3 Jahren
Besitzer

So finally, maybe we should do the opposite: make PrototypeMap final class and create builder/factory methods for observable, multi-index instances:

PrototypeMap
    .fromPrototype(parent)
    .listener(...)
    .listener(...)
    .indexer(by int...)
    .indexer(by cell name...)
    .indexer(by header name...)
    .build()

Of course, if prototype is observable, we should connect it to our map too. Just equivalent to:

    .fromPrototype(parent)
    .listener(parent.router())

Question, maybe our PrototypeMap should directly implement Router? Then we could use shorter version instead (so without any router magic):

   .fromPrototype(parent)
   .listener(parent)
So finally, maybe we should do the opposite: make PrototypeMap **final** class and create builder/factory methods for observable, multi-index instances: ``` PrototypeMap .fromPrototype(parent) .listener(...) .listener(...) .indexer(by int...) .indexer(by cell name...) .indexer(by header name...) .build() ``` Of course, if prototype is observable, we should connect it to our map too. Just equivalent to: ``` .fromPrototype(parent) .listener(parent.router()) ``` Question, maybe our PrototypeMap should directly implement `Router`? Then we could use shorter version instead (so without any router magic): ``` .fromPrototype(parent) .listener(parent) ```
Anmelden, um an der Diskussion teilzunehmen.
Kein Meilenstein
Niemand zuständig
1 Beteiligte
Laden…
Abbrechen
Speichern
Hier gibt es bis jetzt noch keinen Inhalt.