List of usage examples for org.apache.cassandra.db.marshal LongType instance
LongType instance
To view the source code for org.apache.cassandra.db.marshal LongType instance.
Click Source Link
From source file:clojurewerkz.cassaforte.Codec.java
License:Apache License
private static AbstractType getCodecInternal(DataType type) { switch (type.getName()) { case ASCII:/* www . j av a 2 s . co m*/ return AsciiType.instance; case BIGINT: return LongType.instance; case BLOB: return BytesType.instance; case BOOLEAN: return BooleanType.instance; case COUNTER: return CounterColumnType.instance; case DECIMAL: return DecimalType.instance; case DOUBLE: return DoubleType.instance; case FLOAT: return FloatType.instance; case INET: return InetAddressType.instance; case INT: return Int32Type.instance; case TEXT: return UTF8Type.instance; case TIMESTAMP: return DateType.instance; case UUID: return UUIDType.instance; case VARCHAR: return UTF8Type.instance; case VARINT: return IntegerType.instance; case TIMEUUID: return TimeUUIDType.instance; case LIST: return ListType.getInstance(getCodec(type.getTypeArguments().get(0))); case SET: return SetType.getInstance(getCodec(type.getTypeArguments().get(0))); case MAP: return MapType.getInstance(getCodec(type.getTypeArguments().get(0)), getCodec(type.getTypeArguments().get(1))); default: throw new RuntimeException("Unknown type"); } }
From source file:com.blockwithme.longdb.cassandra.ReverseColumnComparator.java
License:Apache License
@Override public Long compose(final ByteBuffer theArg) { return LongType.instance.compose(theArg); }
From source file:com.blockwithme.longdb.cassandra.ReverseColumnComparator.java
License:Apache License
@Override public ByteBuffer decompose(final Long theArg) { return LongType.instance.decompose(theArg); }
From source file:com.blockwithme.longdb.cassandra.ReverseColumnComparator.java
License:Apache License
@Override public ByteBuffer fromString(final String theArg) { return LongType.instance.fromString(theArg); }
From source file:com.blockwithme.longdb.cassandra.ReverseColumnComparator.java
License:Apache License
@Override public String getString(final ByteBuffer theArg) { return LongType.instance.getString(theArg); }
From source file:com.blockwithme.longdb.cassandra.ReverseColumnComparator.java
License:Apache License
@Override public void validate(final ByteBuffer theArg) { LongType.instance.validate(theArg); }
From source file:com.datastax.driver.core.ArrayBackedRow.java
License:Apache License
public long getLong(int i) { metadata.checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); ByteBuffer value = data.get(i); if (value == null || value.remaining() == 0) return 0L; return LongType.instance.compose(value); }
From source file:com.datastax.driver.core.BoundStatement.java
License:Apache License
/** * Set the {@code i}th value to the provided long. * * @param i the index of the variable to set. * @param v the value to set./*from w w w . j a v a 2 s . c o m*/ * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is of type BIGINT or COUNTER. */ public BoundStatement setLong(int i, long v) { metadata().checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); return setValue(i, LongType.instance.decompose(v)); }
From source file:com.datastax.driver.core.Codec.java
License:Apache License
private static AbstractType<?> getCodecInternal(DataType type) { switch (type.getName()) { case ASCII://from www. j a v a2s .co m return AsciiType.instance; case BIGINT: return LongType.instance; case BLOB: return BytesType.instance; case BOOLEAN: return BooleanType.instance; case COUNTER: return CounterColumnType.instance; case DECIMAL: return DecimalType.instance; case DOUBLE: return DoubleType.instance; case FLOAT: return FloatType.instance; case INET: return InetAddressType.instance; case INT: return Int32Type.instance; case TEXT: return UTF8Type.instance; case TIMESTAMP: return DateType.instance; case UUID: return UUIDType.instance; case VARCHAR: return UTF8Type.instance; case VARINT: return IntegerType.instance; case TIMEUUID: return TimeUUIDType.instance; case LIST: return ListType.getInstance(getCodec(type.getTypeArguments().get(0))); case SET: return SetType.getInstance(getCodec(type.getTypeArguments().get(0))); case MAP: return MapType.getInstance(getCodec(type.getTypeArguments().get(0)), getCodec(type.getTypeArguments().get(1))); // We don't interpret custom values in any way case CUSTOM: return BytesType.instance; default: throw new RuntimeException("Unknown type"); } }
From source file:com.datastax.driver.core.Row.java
License:Apache License
/** * Returns the {@code i}th value of this row as a long. * * @param i the index ({@code 0 <= i < size()}) of the column to retrieve. * @return the value of the {@code i}th column in this row as a long. If the * value is NULL, {@code 0L} is returned. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.columns().size()}. * @throws InvalidTypeException if column {@code i} is not of type BIGINT or COUNTER. *//*from www.j a v a2 s . c o m*/ public long getLong(int i) { metadata.checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); ByteBuffer value = data.get(i); if (value == null || value.remaining() == 0) return 0L; return LongType.instance.compose(value); }