当前位置: 首页>>代码示例>>Java>>正文


Java DataType类代码示例

本文整理汇总了Java中org.iotp.infomgt.data.kv.DataType的典型用法代码示例。如果您正苦于以下问题:Java DataType类的具体用法?Java DataType怎么用?Java DataType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataType类属于org.iotp.infomgt.data.kv包,在下文中一共展示了DataType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
@Override
public ListenableFuture<Void> save(EntityId entityId, TsKvEntry tsKvEntry, long ttl) {
    long partition = toPartitionTs(tsKvEntry.getTs());
    DataType type = tsKvEntry.getDataType();
    BoundStatement stmt = (ttl == 0 ? getSaveStmt(type) : getSaveTtlStmt(type)).bind();
    stmt.setString(0, entityId.getEntityType().name())
            .setUUID(1, entityId.getId())
            .setString(2, tsKvEntry.getKey())
            .setLong(3, partition)
            .setLong(4, tsKvEntry.getTs());
    addValue(tsKvEntry, stmt, 5);
    if (ttl > 0) {
        stmt.setInt(6, (int) ttl);
    }
    return getFuture(executeAsyncWrite(stmt), rs -> null);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:CassandraBaseTimeseriesDao.java

示例2: getSaveStmt

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
private PreparedStatement getSaveStmt(DataType dataType) {
    if (saveStmts == null) {
        saveStmts = new PreparedStatement[DataType.values().length];
        for (DataType type : DataType.values()) {
            saveStmts[type.ordinal()] = getSession().prepare("INSERT INTO " + ModelConstants.TS_KV_CF +
                    "(" + ModelConstants.ENTITY_TYPE_COLUMN +
                    "," + ModelConstants.ENTITY_ID_COLUMN +
                    "," + ModelConstants.KEY_COLUMN +
                    "," + ModelConstants.PARTITION_COLUMN +
                    "," + ModelConstants.TS_COLUMN +
                    "," + getColumnName(type) + ")" +
                    " VALUES(?, ?, ?, ?, ?, ?)");
        }
    }
    return saveStmts[dataType.ordinal()];
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:CassandraBaseTimeseriesDao.java

示例3: getSaveTtlStmt

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
private PreparedStatement getSaveTtlStmt(DataType dataType) {
    if (saveTtlStmts == null) {
        saveTtlStmts = new PreparedStatement[DataType.values().length];
        for (DataType type : DataType.values()) {
            saveTtlStmts[type.ordinal()] = getSession().prepare("INSERT INTO " + ModelConstants.TS_KV_CF +
                    "(" + ModelConstants.ENTITY_TYPE_COLUMN +
                    "," + ModelConstants.ENTITY_ID_COLUMN +
                    "," + ModelConstants.KEY_COLUMN +
                    "," + ModelConstants.PARTITION_COLUMN +
                    "," + ModelConstants.TS_COLUMN +
                    "," + getColumnName(type) + ")" +
                    " VALUES(?, ?, ?, ?, ?, ?) USING TTL ?");
        }
    }
    return saveTtlStmts[dataType.ordinal()];
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:CassandraBaseTimeseriesDao.java

示例4: saveLatest

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
@Override
public ListenableFuture<Void> saveLatest(EntityId entityId, TsKvEntry tsKvEntry) {
    DataType type = tsKvEntry.getDataType();
    BoundStatement stmt = getLatestStmt(type).bind()
            .setString(0, entityId.getEntityType().name())
            .setUUID(1, entityId.getId())
            .setString(2, tsKvEntry.getKey())
            .setLong(3, tsKvEntry.getTs());
    addValue(tsKvEntry, stmt, 4);
    return getFuture(executeAsyncWrite(stmt), rs -> null);
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:12,代码来源:CassandraBaseTimeseriesDao.java

示例5: getLatestStmt

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
private PreparedStatement getLatestStmt(DataType dataType) {
    if (latestInsertStmts == null) {
        latestInsertStmts = new PreparedStatement[DataType.values().length];
        for (DataType type : DataType.values()) {
            latestInsertStmts[type.ordinal()] = getSession().prepare("INSERT INTO " + ModelConstants.TS_KV_LATEST_CF +
                    "(" + ModelConstants.ENTITY_TYPE_COLUMN +
                    "," + ModelConstants.ENTITY_ID_COLUMN +
                    "," + ModelConstants.KEY_COLUMN +
                    "," + ModelConstants.TS_COLUMN +
                    "," + getColumnName(type) + ")" +
                    " VALUES(?, ?, ?, ?, ?)");
        }
    }
    return latestInsertStmts[dataType.ordinal()];
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:16,代码来源:CassandraBaseTimeseriesDao.java

示例6: getColumnName

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
private static String getColumnName(DataType type) {
    switch (type) {
        case BOOLEAN:
            return ModelConstants.BOOLEAN_VALUE_COLUMN;
        case STRING:
            return ModelConstants.STRING_VALUE_COLUMN;
        case LONG:
            return ModelConstants.LONG_VALUE_COLUMN;
        case DOUBLE:
            return ModelConstants.DOUBLE_VALUE_COLUMN;
        default:
            throw new RuntimeException("Not implemented!");
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:15,代码来源:CassandraBaseTimeseriesDao.java

示例7: forValue

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
@JsonCreator
public static DataTypeMapping forValue(String value) {
    return new DataTypeMapping(DataType.valueOf(value.toUpperCase()));
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:5,代码来源:DataTypeMapping.java

示例8: forValue

import org.iotp.infomgt.data.kv.DataType; //导入依赖的package包/类
@JsonCreator
public static DataTypeMapping forValue(String value) {
  return new DataTypeMapping(DataType.valueOf(value.toUpperCase()));
}
 
开发者ID:osswangxining,项目名称:iot-edge-greengrass,代码行数:5,代码来源:DataTypeMapping.java


注:本文中的org.iotp.infomgt.data.kv.DataType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。