Interface MissingFieldHandler

All Known Subinterfaces:
JsonReader.MissingFieldHandler

public interface MissingFieldHandler
Implement this interface to react to fields missing when reading an object. This handler will be called after all deserialization has occurred to allow all references to be resolved.

Register your handler using ReadOptionsBuilder.missingFieldHandler(MissingFieldHandler).

Author:
John DeRegnaucourt (jdereg@gmail.com)
Copyright (c) Cedar Software LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    fieldMissing(Object object, String fieldName, Object value)
    Notify that a field is missing from the target object during deserialization.
  • Method Details

    • fieldMissing

      void fieldMissing(Object object, String fieldName, Object value)
      Notify that a field is missing from the target object during deserialization.

      Warning: not every type can be deserialized upon missing fields. Arrays and Object types that do not have serialized @type definition will be ignored.

      Parameters:
      object - the object that contains the missing field
      fieldName - name of the field that was in the JSON but not found in the object
      value - the value from JSON that could not be assigned to a field