當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。