@Override public ULong convert(Long in, Context context) throws Exception { if (in == null) { return null; } return ULong.valueOf(in); } });
/** * Create an <code>unsigned long</code> by masking it with * <code>0xFFFFFFFFFFFFFFFF</code> i.e. <code>(long) -1</code> becomes * <code>(uint) 18446744073709551615</code> */ public static ULong valueOf(long value) { return new ULong(value); }
@Override public ScalarMongoTimestamp toValue(Long value) { BigInteger bigValue = ULong.valueOf(value).toBigInteger(); return new DefaultScalarMongoTimestamp(bigValue.shiftRight(32).intValue(), bigValue.shiftLeft(32).shiftRight(32).intValue()); }
@Override final void set0(BindingSetStatementContext<U> ctx, ULong value) throws SQLException { ctx.statement().setBigDecimal(ctx.index(), new BigDecimal(value.toString())); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned long</code> */ private ULong(BigInteger value) throws NumberFormatException { this.value = value; rangeCheck(); }
@Override public int compareTo(ULong o) { return compare(value, o.value); }
public ULong add(int val) throws NumberFormatException { return add((long) val); }
@Override final void set0(BindingSetSQLOutputContext<U> ctx, ULong value) throws SQLException { ctx.output().writeBigDecimal(new BigDecimal(value.toString())); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> does not contain a * parsable <code>unsigned long</code>. */ private ULong(String value) throws NumberFormatException { this.value = new BigInteger(value); rangeCheck(); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> does not contain a * parsable <code>unsigned long</code>. */ private ULong(String value) throws NumberFormatException { if (value == null) throw new NumberFormatException("null"); int length = value.length(); if (length == 0) throw new NumberFormatException("Empty input string"); if (value.charAt(0) == '-') throw new NumberFormatException( String.format("Illegal leading minus sign on unsigned string %s", value)); if (length <= 18) { this.value = Long.parseLong(value, 10); return; } final long first = Long.parseLong(value.substring(0, length - 1), 10); final int second = Character.digit(value.charAt(length - 1), 10); if (second < 0) throw new NumberFormatException("Bad digit at end of " + value); long result = first * 10 + second; if (compare(result, first) < 0) throw new NumberFormatException( String.format("String value %s exceeds range of unsigned long", value)); this.value = result; }
/** * Create an <code>unsigned long</code> by masking it with * <code>0xFFFFFFFFFFFFFFFF</code> i.e. <code>(long) -1</code> becomes * <code>(uint) 18446744073709551615</code> * * @see ULong#valueOf(long) */ public static ULong ulong(long value) { return ULong.valueOf(value); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> does not contain a * parsable <code>unsigned long</code>. */ public static ULong valueOf(String value) throws NumberFormatException { return new ULong(value); }
@Override final void sqlInline0(BindingSQLContext<U> ctx, ULong value) { ctx.render().sql(value.toString()); }
/** * Create an <code>unsigned long</code> by masking it with * <code>0xFFFFFFFFFFFFFFFF</code> i.e. <code>(long) -1</code> becomes * <code>(uint) 18446744073709551615</code> * * @see ULong#valueOf(long) */ public static ULong ulong(long value) { return ULong.valueOf(value); }
/** * Create an <code>unsigned long</code> * * @throws NumberFormatException If <code>value</code> is not in the range * of an <code>unsigned long</code> */ public static ULong valueOf(BigInteger value) throws NumberFormatException { return new ULong(value); }
@Override public ULong convert(BigInteger in, Context context) throws Exception { if (in == null) { return null; } return ULong.valueOf(in); } });