Avro
  1. Avro
  2. AVRO-1552

Option to use primitive wrappers for fields

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      It'd be nice if there were an option for SpecificCompiler that would use primitive wrappers (Integer, Long, etc) instead of their primitive types (int, long, etc). One use case is that the serialization would still fail if these were not set and one didn't use the builder.

        Activity

        Hide
        Keegan Witt added a comment -

        Out of curiosity, why are primitives used at all? The getters and setters seem to use the primitive wrappers anyway.

        Show
        Keegan Witt added a comment - Out of curiosity, why are primitives used at all? The getters and setters seem to use the primitive wrappers anyway.
        Hide
        Keegan Witt added a comment -

        For our use case, we avoided the use of the builder because we didn't want to have hard-coded references to the setters and wanted to use the record's put() instead to programmatically map objects. So another way our particular problem could be solved is if builders had a put(int field, Object value) method and a put(String fieldName, Object value) method that also updated fieldSetFlags. If you don't object to that idea, I can open a Jira for it as well.

        Show
        Keegan Witt added a comment - For our use case, we avoided the use of the builder because we didn't want to have hard-coded references to the setters and wanted to use the record's put() instead to programmatically map objects. So another way our particular problem could be solved is if builders had a put(int field, Object value) method and a put(String fieldName, Object value) method that also updated fieldSetFlags . If you don't object to that idea, I can open a Jira for it as well.
        Hide
        Keegan Witt added a comment -

        Sorry for opening a Jira so quickly on this, I probably should have discussed it on the mailing list first.

        Show
        Keegan Witt added a comment - Sorry for opening a Jira so quickly on this, I probably should have discussed it on the mailing list first.

          People

          • Assignee:
            Unassigned
            Reporter:
            Keegan Witt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development