Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8071471 Serialization Improvements
  3. JDK-8071473

Add static validator method for stream fields

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 9
    • core-libs
    • None

      This issue has been filed to investigate the possibility of adding a static
      validator(GetField) API to the deserialization process. Such an API could
      be used to validate the stream fields before an instance of the object is
      created.

      A clear and easy to understand mechanism that can validate the deserialized
      fields. Does not prevent the use of final fields, as the serialization framework
      will be responsible for setting them. Something along the lines of what David
      suggested:
         
          private static void validate(GetField fields) {
              if (fields.getInt("lo") > fields.getInt("hi")) { ... }
         }

      This could be a “special” method, or annotation driven. TBD.

      Note: the validate method is static, so the object instance is not required to
      be created before running the validation.

            chegar Chris Hegarty
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: