XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha3
    • None
    • Docs Required

    Description

      Implement some order for @NamedConfigValue fields.

      Imagine that we have some

       

      @Config
      public class PKIndexConfigurationSchema {
          @Value
          String type;
          @NamedConfigValue
          IndexColumnConfigurationSchema columns.
       
      

      and

       

      @Config
      public class IndexColumnConfigurationSchema {
          @Value
          String name;
          @Value
          boolean asc;
          @Value
          boolean affinityCol;
      }
      

       

      For now we have to use indexes to store such config like:

       

      "PK":
          "type":"PrimaryKey",
          "columns": {
              "0": {
                  "name":"REGION",
                  "asc":true,
                  "affinity":true
              },
              "1": {
                  "name":"COMPANY",
                  "asc":true,
                  "affinity":false
              }
          }
      

       

      because we have to keep it's order.

      But if configuration keep order for @NamedConfigValue it can look like:

       

      "PK":
          "type":"PrimaryKey",
          "columns": {
              "REGION": {
                  "asc":true,
                  "affinity":true
              },
              "COMPANY": {
                  "asc":true,
                  "affinity":false
              }
          }
      

      And to allow insert value in the middle it will be nice to have some methods like:

      • listChange.create(idx, key, consumer(elementChange))

      or

      • listChange.createAfter(prevKeyOrNull, key, consumer(elementChange))

      in addition to existing:

      • listChange.create(key, consumer(elementChange))
      • listChange.update(key, consumer(elementChange))
      • listChange.delete(key)

      BTW, lets remove listChange.update method.

      Implementation notes

      It would make sense to store order number inside of named list entry. It would look like implicit configuration parameter <idx>, for example. This value will be recalculated on every update.

      Index will be stored in named list itself, entries will not contain it. Reason is simple - named list entries can be used as regular "inner" nodes and we can't distinguish one from the another. That's why index is implicit.

      API notes

      I don't get why we need to remove update method. It would be helpful to update their semantics, like "create" would throw "AlreadyExistsException" or something, update would do similar thing with "KeyNotFound"...

      Attachments

        Issue Links

          Activity

            People

              ibessonov Ivan Bessonov
              Berkov Alexander Belyak
              Aleksandr Polovtsev Aleksandr Polovtsev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 8h 20m
                  8h 20m