Java 类com.datastax.driver.core.TupleValue 实例源码

项目:Troilus    文件:KeyByAccountColumns.java   
@Override
public CompletableFuture<ImmutableSet<? extends Batchable<?>>> onWrite(WriteQueryData queryData) {

    // this interceptor does not support where condition based queries
    if (!queryData.getWhereConditions().isEmpty()) {
        throw new InvalidQueryException("where condition based queries are not supported");
    }

    if (queryData.hasKey(ACCOUNT_ID) && queryData.hasValueToMutate(KEY) && queryData.hasSetValuesToAddOrSet(EMAIL_IDX)) {
        List<Write> writes = Lists.newArrayList();
        for (TupleValue tupleValue : queryData.getSetValuesToAddOrSet(EMAIL_IDX)) {
            writes.add(keyByEmailDao.writeWithKey(KeyByEmailColumns.EMAIL, tupleValue.getString(0), KeyByEmailColumns.CREATED, tupleValue.getLong(1))
                                    .value(KeyByEmailColumns.KEY, queryData.getValueToMutate(KEY))
                                    .value(KeyByEmailColumns.ACCOUNT_ID, queryData.getKey(ACCOUNT_ID))
                                    .withConsistency(ConsistencyLevel.QUORUM));
        }
        return CompletableFuture.completedFuture(ImmutableSet.copyOf(writes));

    } else {
        return CompletableFuture.completedFuture(ImmutableSet.of());
    }
}
项目:camel-cql    文件:CqlToken.java   
/**
 * Bind Tuple to BoundStatement.
 * 
 * @param bs
 * @param inList
 * @throws Exception
 */
public void bindTuple(Session session, BoundStatement bs,
        List<Object> inList) throws Exception {
    if (!isCollection()) {
        throw new Exception(
                "attempting to bind non-collection as collection");
    }
    LOG.trace("bindTuple: entered with {}", inList.toString());
    LOG.trace("bindTuple: first object's type {}", inList.get(0).getClass()
            .getCanonicalName());
    TupleType tupleType = Utils.getTupleType(session.getCluster()
            .getMetadata(), inList);
    TupleValue tv = tupleType.newValue(inList.toArray(new Object[inList
            .size()]));
    for (Integer pos : getPositions())
        bs.setTupleValue(pos, tv);
}
项目:SimpleFlatMapper    文件:TupleValueSettableDataSetter.java   
@Override
public void set(SettableByIndexData target, TupleValue value) throws Exception {
    if (value == null) {
        target.setToNull(index);
    } else {
        target.setTupleValue(index, value);
    }
}
项目:SimpleFlatMapper    文件:ConverterToTupleValueMapper.java   
@Override
public TupleValue convert(I in) throws Exception {
    if (in == null) return null;
    TupleValue tv = tupleType.newValue();
    mapper.mapTo(in, tv, null);
    return tv;
}
项目:Troilus    文件:KeyByAccountColumns.java   
private ImmutableSet<Deletion> getDeletions(Record record) {
    List<Deletion> deletions = Lists.newArrayList();
    for (TupleValue tupleValue : record.getValue(KeyByAccountColumns.EMAIL_IDX)) {
        deletions.add(keyByEmailDao.deleteWithKey(KeyByEmailColumns.EMAIL, tupleValue.getString(0), KeyByEmailColumns.CREATED, tupleValue.getLong(1))
                                   .withConsistency(ConsistencyLevel.QUORUM));
    }

    return ImmutableSet.copyOf(deletions);
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
public Class<TupleValue> getType()
{
    return TupleValue.class;
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
public TupleValue compose(Object obj)
{
    return (TupleValue)obj;
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
public Object decompose(TupleValue value)
{
    return (Object) value;
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
@Override
public int getScale(TupleValue obj) {
    // TODO Auto-generated method stub
    return -1;
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
@Override
public int getPrecision(TupleValue obj) {
    // TODO Auto-generated method stub
    return -1;
}
项目:cassandra-jdbc-wrapper    文件:JdbcTuple.java   
@Override
public String toString(TupleValue obj) {
    // TODO Auto-generated method stub
    return obj.toString();
}
项目:cassandra-jdbc-wrapper    文件:MetadataRow.java   
public TupleValue getTupleValue(int i) {
    return null;
}
项目:cassandra-jdbc-wrapper    文件:MetadataRow.java   
public TupleValue getTupleValue(String name) {
    return null;
}
项目:scylla-tools-java    文件:CqlRecordReader.java   
@Override
public TupleValue getTupleValue(int i)
{
    return row.getTupleValue(i);
}
项目:scylla-tools-java    文件:CqlRecordReader.java   
@Override
public TupleValue getTupleValue(String name)
{
    return row.getTupleValue(name);
}
项目:SimpleFlatMapper    文件:DataTypeHelper.java   
public static Class<?> asJavaClass(DataType.Name name) {
    if (name == null) return null;
    switch (name) {
        case ASCII:
            return String.class;
        case BIGINT:
            return Long.class;
        case BLOB:
            return ByteBuffer.class;
        case BOOLEAN:
            return Boolean.class;
        case COUNTER:
            return Long.class;
        case DECIMAL:
            return BigDecimal.class;
        case DOUBLE:
            return Double.class;
        case FLOAT:
            return Float.class;
        case INET:
            return InetAddress.class;
        case INT:
            return Integer.class;
        case LIST:
            return List.class;
        case MAP:
            return Map.class;
        case SET:
            return Set.class;
        case TEXT:
            return String.class;
        case TIMESTAMP:
            return Date.class;
        case TIMEUUID:
            return UUID.class;
        case UUID:
            return UUID.class;
        case VARCHAR:
            return String.class;
        case VARINT:
            return BigInteger.class;
        case UDT:
            return UDTValue.class;
        case TUPLE:
            return TupleValue.class;
        case CUSTOM:
            return ByteBuffer.class;
    }

    if (isDate(name)) return localDateClass;
    if (isTime(name)) return Long.class;
    if (isSmallInt(name)) return Short.class;
    if (isTinyInt(name)) return Byte.class;
    return null;
}
项目:SimpleFlatMapper    文件:DatastaxTupleValueGetter.java   
@Override
public TupleValue get(GettableByIndexData target) throws Exception {
    return target.getTupleValue(index);
}
项目:SimpleFlatMapper    文件:ConverterToTupleValueMapper.java   
public ConverterToTupleValueMapper(Mapper<I, TupleValue> mapper, TupleType tupleType) {
    this.mapper = mapper;
    this.tupleType = tupleType;
}
项目:SimpleFlatMapper    文件:DbObjectsWithTupleValue.java   
public TupleValue getT() {
    return t;
}
项目:SimpleFlatMapper    文件:DbObjectsWithTupleValue.java   
public void setT(TupleValue t) {
    this.t = t;
}
项目:Troilus    文件:RecordAdapter.java   
@Override
public TupleValue getTupleValue(String name) {
    return record.getTupleValue(name);
}
项目:Troilus    文件:RecordImpl.java   
@Override
public TupleValue getTupleValue(String name) {
    return row.getTupleValue(name);
}
项目:hawkular-metrics    文件:MockRow.java   
@Override
public TupleValue getTupleValue(int i) {
    throw new UnsupportedOperationException();
}
项目:hawkular-metrics    文件:MockRow.java   
@Override
public TupleValue getTupleValue(String name) {
    throw new UnsupportedOperationException();
}
项目:camel-cql    文件:CqlToken.java   
public static Object getObjectFromRow(Row row, String colName,
        DataType.Name type) {
    switch (type) {
    case BLOB:
        return row.getBytes(colName);
    case DECIMAL:
        return row.getDecimal(colName);
    case VARINT:
        return row.getVarint(colName);
    case BOOLEAN:
        return row.getBool(colName);
    case INET:
        return row.getInet(colName);
    case INT:
        return row.getInt(colName);
    case SMALLINT:
        return row.getShort(colName);
    case TINYINT:
        return row.getByte(colName);
    case BIGINT:
    case COUNTER:
    case TIME:
        return row.getLong(colName);
    case FLOAT:
        return row.getFloat(colName);
    case DOUBLE:
        return row.getDouble(colName);
    case DATE:
        return row.getDate(colName);
    case TIMESTAMP:
        return row.getTimestamp(colName);
    case TIMEUUID:
    case UUID:
        return row.getUUID(colName);
    case SET:
        return row.getSet(colName, String.class);
    case LIST:
        return row.getList(colName, String.class);
    case MAP:
        return row.getMap(colName, String.class, String.class);
    case TUPLE:
        // A tuple would have to be returned as a List of Objects
        List<Object> tupleObjs = new ArrayList<Object>();
        TupleValue tv = row.getTupleValue(colName);
        // get a bead on the number of values in the tuple
        int numValues = tv.getType().getComponentTypes().size();
        // copy corresponding objects to list
        for (int i = 0; i < numValues; i++) {
            tupleObjs.add(tv.getObject(i));
        }
        return tupleObjs;
    default:
        return row.getString(colName);
    }
}
项目:taulukko-commons-ceu    文件:GettableByIndexData.java   
/**
 * Return the {@code i}th value as a tuple value.
 *  
 * This method uses the {@link CodecRegistry} to find a codec to convert the
 * underlying CQL type to a {@code TupleValue} (if the CQL type is a tuple,
 * the registry will generate a codec automatically).
 *
 * @param i
 *            the index ({@code 0 <= i < size()}) to retrieve.
 * @return the value of the {@code i}th element as a tuple value. If the
 *         value is NULL, then {@code null} will be returned.
 * @throws IndexOutOfBoundsException
 *             if {@code i} is not a valid index for this object.
 * @throws CodecNotFoundException
 *             if there is no registered codec to convert the element's CQL
 *             type to a {@code TupleValue}.
 */
public TupleValue getTupleValue(int i);
项目:Troilus    文件:Record.java   
/**
 * @param name the name to retrieve.
 * @return the value of {@code name} as a tuple value. If the value is NULL, null will be returned.
 */
TupleValue getTupleValue(String name);
项目:Troilus    文件:Record.java   
/**
 * @param name the name to retrieve.
 * @return the value of {@code name} as a tuple value. If the value is NULL, null will be returned.
 */
TupleValue getTupleValue(String name);
项目:Troilus    文件:ColumnName.java   
/**
 * defines a new name with TupleValue-typed value
 * 
 * @param name        the name 
 * @return a new instance
 */
public static ColumnName<TupleValue> defineTupleValue(String name) {
    return define(name, TupleValue.class);
}