All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.dataformat.cbor.CBORSimpleValue Maven / Gradle / Ivy

package com.fasterxml.jackson.dataformat.cbor;

/**
 * Simple value object to be used for exposing undefined "simple values"
 * when encountered during parsing.
 * Note that as of Jackson 2.12, this class is not yet used for
 * exposing simple values: instead they are report as
 * {@link com.fasterxml.jackson.core.JsonToken#VALUE_NUMBER_INT}s.
 *

* Simple values left undefined in * CBOR 1.0 * specification contain values {@code [0 - 19], [32, 255]}: other * values are not used to represent general simple values. * Specifically, values below {@code 0}, above {@code 255} or * in range {@code [20, 31] (inclusive)} are never exposed. *

* Values are not guaranteed to be canonicalized, but being immutable * may be reused (and in future possible canonicalized if that makes sense). *

* Note that it is possible that some of above-mentioned values may be * defined to have specific meaning and get reported using some other * mechanism. * * @since 2.12 */ public class CBORSimpleValue { /** * Actual numeric value represented. Usually should be in range * of {@code [0-19][32-255]}. */ protected final int _value; public CBORSimpleValue(int value) { _value = value; } /** * Accessor for the simple integer value represented * * @return Simple integer value this instance represents */ public int getValue() { return _value; } @Override public int hashCode() { return _value; } @Override public String toString() { return Integer.valueOf(_value).toString(); } @Override public boolean equals(Object o) { if (o == this) return true; if (o instanceof CBORSimpleValue) { CBORSimpleValue other = (CBORSimpleValue) o; return _value == other._value; } return false; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy