private Object deNormalize()

in elastic-db-tools/src/main/java/com/microsoft/azure/elasticdb/shard/base/ShardKey.java [908:946]


    private Object deNormalize(ShardKeyType keyType,
            byte[] value) {
        // Return null for positive infinity.
        if (value == null) {
            return null;
        }

        switch (keyType) {
            case Int32:
                return deNormalizeInt32(value);

            case Int64:
                return deNormalizeInt64(value);

            case Guid:
                return deNormalizeGuid(value);

            case DateTime:
                long dtTicks = deNormalizeInt64(value);
                if (dtTicks == Long.MIN_VALUE) {
                    return LocalDateTime.MIN;
                }
                long epochSeconds = (dtTicks - TICKS_AT_EPOCH) / TICKS_PER_MILLISECOND;
                ZoneOffset offset = ZoneId.systemDefault().getRules().getOffset(LocalDateTime.now());
                return LocalDateTime.ofEpochSecond(epochSeconds, 0, offset);

            case TimeSpan:
                long tsTicks = deNormalizeInt64(value);
                return tsTicks == Long.MIN_VALUE ? Duration.ZERO : Duration.ofSeconds(tsTicks);

            case DateTimeOffset:
                return deNormalizeDateTimeOffset(value);

            default:
                // For varbinary type, we simply keep it as a VarBytes object
                assert keyType == ShardKeyType.Binary;
                return this.value;
        }
    }