Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-15787

Add annotation support to POJO Mappers.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • sql
    • Docs Required, Release Notes Required

    Description

      Let's introduce annotations for mapper builder.

      Suggested annotations:

      • Transient - that makes mapper ignore the marked field. Field data will not be saved into a table.
      • Column(String) - maps field to a field of the given name.
      • Column(Class) - maps field to a field of given name using converter class.

      This will allow users to create mapper like this

      class Record {
          @Transient
          transient Object cachedData;
      
         @Column(UserMarshaller.class)
          UseObject value;
      
          @Column("key")
          UUID id;
      }
      
      Mappers.forClass(Record.class)
      

      instead of like this

       Mappers.of(Record.class)
          .map("id", "key")
          .map("value", 
              (obj) -> Marshaller.marshal(obj), 
              (row) -> Marshaller.unmarshal(row)
          );
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              amashenkov Andrey Mashenkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: