ColumnMapperBigInteger.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:stratio-cassandra 作者:
/**
 * Builds a new {@link ColumnMapperBigDecimal} using the specified max number of digits.
 *
 * @param digits The max number of digits. If {@code null}, the {@link #DEFAULT_DIGITS} will be used.
 */
@JsonCreator
public ColumnMapperBigInteger(@JsonProperty("digits") Integer digits) {
    super(new AbstractType<?>[]{AsciiType.instance,
                                UTF8Type.instance,
                                Int32Type.instance,
                                LongType.instance,
                                IntegerType.instance}, new AbstractType[]{});

    if (digits != null && digits <= 0) {
        throw new IllegalArgumentException("Positive digits required");
    }

    this.digits = digits == null ? DEFAULT_DIGITS : digits;
    complement = BigInteger.valueOf(10).pow(this.digits).subtract(BigInteger.valueOf(1));
    BigInteger maxValue = complement.multiply(BigInteger.valueOf(2));
    hexDigits = encode(maxValue).length();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号