Interface KeysAwareDecoder

All Superinterfaces:
AutoCloseable, Decoder
All Known Implementing Classes:
BsonReaderDecoder, JacksonDecoder

@Internal public interface KeysAwareDecoder extends Decoder
Optional decoder capability for matching object keys against a known key set.
Since:
3.1
Author:
Denis Stepanov
  • Field Details

    • MATCH_END_OBJECT

      static final int MATCH_END_OBJECT
      Marker for case where the end of an object was encountered.
      See Also:
    • MATCH_UNKNOWN_NAME

      static final int MATCH_UNKNOWN_NAME
      Marker for case where a property name was encountered but not matched by the Keys supplied to decodeKey(Keys). After this marker is returned, callers should obtain the unmatched property name with Decoder.decodeKey() and handle it as unknown for that same key set. Implementations must not return this marker for a property that matches the supplied keys.
      See Also:
  • Method Details

    • of

      static KeysAwareDecoder of(Decoder decoder)
      Adapt the decoder to the keys-aware contract.
      Parameters:
      decoder - The decoder
      Returns:
      A keys-aware decoder
    • decodeKey

      int decodeKey(Keys keys) throws IOException
      Decode the next object key and match it against the supplied key set. A non-negative result is the matched key index. MATCH_UNKNOWN_NAME means the current key is available through Decoder.decodeKey() and is guaranteed not to match the supplied Keys.
      Parameters:
      keys - The keys
      Returns:
      The matched key index, MATCH_END_OBJECT, or MATCH_UNKNOWN_NAME
      Throws:
      IOException - If an unrecoverable error occurs