Package io.permazen.encoding
Class ShortEncoding
java.lang.Object
- All Implemented Interfaces:
Encoding<Short>,NaturalSortAware,Serializable,Comparator<Short>
Short type.
- See Also:
-
Field Summary
Fields inherited from class io.permazen.encoding.AbstractEncoding
encodingId, typeTokenFields inherited from interface io.permazen.encoding.Encoding
MAX_ARRAY_DIMENSIONS -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.permazen.encoding.IntegralEncoding
getFixedWidth, hasPrefix0x00, hasPrefix0xff, read, skip, upCast, writeMethods inherited from class io.permazen.encoding.PrimitiveEncoding
compare, convert, equals, fromString, hashCode, sortsNaturally, supportsNull, toStringMethods inherited from class io.permazen.encoding.AbstractEncoding
getDefaultValue, getDefaultValueBytes, getEncodingId, getTypeToken, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface io.permazen.encoding.Encoding
decode, encode, validateAndWrite
-
Constructor Details
-
ShortEncoding
-
-
Method Details
-
convertNumber
- Specified by:
convertNumberin classPrimitiveEncoding<Short>
-
downCast
- Specified by:
downCastin classIntegralEncoding<Short>
-
validate
Description copied from interface:EncodingVerify the given object is a valid instance of thisEncoding's Java type and cast it to that type.Note that this method must throw
IllegalArgumentException, notClassCastExceptionorNullPointerException, ifobjdoes not have the correct type, or is an unsupported value - including null if null is not supported.This method is allowed to perform widening conversions of the object that lose no information, e.g., from
IntegertoLong.The implementation in
Encodingfirst verifies the value is not null if this instance does not allow null values, and then attempts to cast the value using this instance's raw Java type. Subclasses should override this method to implement any other restrictions.
-