001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.marshall.stream;
018
019/**
020 * Discriminant returned by {@link TokenReader#getNativeKind()} that classifies the
021 * binary-native metadata (if any) carried by the cursor's current token.
022 *
023 * <p>
024 * A {@link TokenReader} surfaces format-native value types as <b>metadata on the existing
025 * token vocabulary</b> rather than as new top-level events.  A native wrapper rides on whatever
026 * token the wrapped value emits ({@code VALUE_*} or {@code START_*}); this enum lets a
027 * format-agnostic consumer branch on the kind of native metadata without having to test the
028 * cursor's runtime type.
029 *
030 * <p>
031 * Each enum value names the concrete native concept it represents.  New values may be added in
032 * future minor releases as additional formats expose native opt-in metadata.
033 *
034 * <h5 class='section'>See Also:</h5><ul>
035 *    <li>{@link TokenReader} &mdash; the cursor that exposes this discriminant.
036 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SerializersAndParsers">Serializers and Parsers</a>
037 * </ul>
038 */
039public enum BinaryNativeKind {
040
041   /** The current token carries no binary-native metadata. */
042   NONE,
043
044   /**
045    * The current token is wrapped by one or more semantic tags (CBOR major type 6).  Surfaced
046    * via {@link TokenReader#getTagCount()} / {@link TokenReader#getTag(int)}.
047    */
048   CBOR_TAG,
049
050   /**
051    * The current token represents a CBOR simple value (major type 7).  Token type is
052    * {@link TokenType#VALUE_NULL}; the simple int is surfaced via
053    * {@link TokenReader#getSimpleValue()}.
054    */
055   CBOR_SIMPLE,
056
057   /**
058    * The current token represents a MsgPack {@code ext} value (signed type byte + binary
059    * payload).  Token type is {@link TokenType#VALUE_BINARY}; the type byte is surfaced via
060    * {@link TokenReader#getExtType()}.
061    */
062   MSGPACK_EXT
063}