private static Object decompose(Object value, Class clazz) { ByteBuffer buf = ByteBuffer.wrap((byte[]) value, 0, ((byte[]) value).length); return Int32Type.instance.compose(buf); } }
public int getInt(String column) { return Int32Type.instance.compose(data.get(column)); }
public int getInt(String column) { return Int32Type.instance.compose(data.get(column)); }
public int getInt(String column) { return Int32Type.instance.compose(data.get(column)); }
public int getInt(String column) { return Int32Type.instance.compose(data.get(column)); }
upcastToken = (long) Int32Type.instance.compose(term); break;
upcastToken = (long) Int32Type.instance.compose(term); break;
upcastToken = (long) Int32Type.instance.compose(term); break;
public int getTimeToLive(QueryOptions options, int defaultTimeToLive) throws InvalidRequestException { if (timeToLive == null) return defaultTimeToLive; ByteBuffer tval = timeToLive.bindAndGet(options); if (tval == null) return 0; if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER) return defaultTimeToLive; try { Int32Type.instance.validate(tval); } catch (MarshalException e) { throw new InvalidRequestException("Invalid timestamp value: " + tval); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl); if (ttl > MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, MAX_TTL)); if (defaultTimeToLive != LivenessInfo.NO_TTL && ttl == LivenessInfo.NO_TTL) return LivenessInfo.NO_TTL; return ttl; }
public int getTimeToLive(QueryOptions options) throws InvalidRequestException { if (timeToLive == null) return 0; ByteBuffer tval = timeToLive.bindAndGet(options); if (tval == null) throw new InvalidRequestException("Invalid null value of TTL"); try { Int32Type.instance.validate(tval); } catch (MarshalException e) { throw new InvalidRequestException("Invalid timestamp value"); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) throw new InvalidRequestException("A TTL must be greater or equal to 0"); if (ttl > ExpiringCell.MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, ExpiringCell.MAX_TTL)); return ttl; }
public int getTimeToLive(QueryOptions options, CFMetaData metadata) throws InvalidRequestException { if (timeToLive == null) { ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, metadata.params.defaultTimeToLive, true); return metadata.params.defaultTimeToLive; } ByteBuffer tval = timeToLive.bindAndGet(options); if (tval == null) return 0; if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER) return metadata.params.defaultTimeToLive; try { Int32Type.instance.validate(tval); } catch (MarshalException e) { throw new InvalidRequestException("Invalid timestamp value: " + tval); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl); if (ttl > MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, MAX_TTL)); if (metadata.params.defaultTimeToLive != LivenessInfo.NO_TTL && ttl == LivenessInfo.NO_TTL) return LivenessInfo.NO_TTL; ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, ttl, false); return ttl; }
private int getLimit(Term limit, QueryOptions options) { int userLimit = DataLimits.NO_LIMIT; if (limit != null) { ByteBuffer b = checkNotNull(limit.bindAndGet(options), "Invalid null value of limit"); // treat UNSET limit value as 'unlimited' if (b != UNSET_BYTE_BUFFER) { try { Int32Type.instance.validate(b); userLimit = Int32Type.instance.compose(b); checkTrue(userLimit > 0, "LIMIT must be strictly positive"); } catch (MarshalException e) { throw new InvalidRequestException("Invalid limit value"); } } } return userLimit; }
private int getLimit(Term limit, QueryOptions options) { int userLimit = DataLimits.NO_LIMIT; if (limit != null) { ByteBuffer b = checkNotNull(limit.bindAndGet(options), "Invalid null value of limit"); // treat UNSET limit value as 'unlimited' if (b != UNSET_BYTE_BUFFER) { try { Int32Type.instance.validate(b); userLimit = Int32Type.instance.compose(b); checkTrue(userLimit > 0, "LIMIT must be strictly positive"); } catch (MarshalException e) { throw new InvalidRequestException("Invalid limit value"); } } } return userLimit; }
private int getLimit(Term limit, QueryOptions options) { int userLimit = DataLimits.NO_LIMIT; if (limit != null) { ByteBuffer b = checkNotNull(limit.bindAndGet(options), "Invalid null value of limit"); // treat UNSET limit value as 'unlimited' if (b != UNSET_BYTE_BUFFER) { try { Int32Type.instance.validate(b); userLimit = Int32Type.instance.compose(b); checkTrue(userLimit > 0, "LIMIT must be strictly positive"); } catch (MarshalException e) { throw new InvalidRequestException("Invalid limit value"); } } } return userLimit; }
/** * May be used by custom QueryHandler implementations */ public int getLimit(QueryOptions options) throws InvalidRequestException { int l = Integer.MAX_VALUE; if (limit != null) { ByteBuffer b = limit.bindAndGet(options); if (b == null) throw new InvalidRequestException("Invalid null value of limit"); try { Int32Type.instance.validate(b); l = Int32Type.instance.compose(b); } catch (MarshalException e) { throw new InvalidRequestException("Invalid limit value"); } } if (l <= 0) throw new InvalidRequestException("LIMIT must be strictly positive"); return l; }
public int getTimeToLive(QueryOptions options, CFMetaData metadata) throws InvalidRequestException { if (timeToLive == null) { ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, metadata.params.defaultTimeToLive, true); return metadata.params.defaultTimeToLive; } ByteBuffer tval = timeToLive.bindAndGet(options); if (tval == null) return 0; if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER) return metadata.params.defaultTimeToLive; try { Int32Type.instance.validate(tval); } catch (MarshalException e) { throw new InvalidRequestException("Invalid timestamp value: " + tval); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl); if (ttl > MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, MAX_TTL)); if (metadata.params.defaultTimeToLive != LivenessInfo.NO_TTL && ttl == LivenessInfo.NO_TTL) return LivenessInfo.NO_TTL; ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, ttl, false); return ttl; }
public int getTimeToLive(QueryOptions options, CFMetaData metadata) throws InvalidRequestException { if (timeToLive == null) { ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, metadata.params.defaultTimeToLive, true); return metadata.params.defaultTimeToLive; } ByteBuffer tval = timeToLive.bindAndGet(options); if (tval == null) return 0; if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER) return metadata.params.defaultTimeToLive; try { Int32Type.instance.validate(tval); } catch (MarshalException e) { throw new InvalidRequestException("Invalid timestamp value: " + tval); } int ttl = Int32Type.instance.compose(tval); if (ttl < 0) throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl); if (ttl > MAX_TTL) throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, MAX_TTL)); if (metadata.params.defaultTimeToLive != LivenessInfo.NO_TTL && ttl == LivenessInfo.NO_TTL) return LivenessInfo.NO_TTL; ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy(metadata, ttl, false); return ttl; }
int version = Int32Type.instance.compose(hint.name().get(1)); DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(hint.value())); Mutation mutation;