本文整理匯總了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);
}
示例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()];
}
示例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()];
}
示例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);
}
示例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()];
}
示例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!");
}
}
示例7: forValue
import org.iotp.infomgt.data.kv.DataType; //導入依賴的package包/類
@JsonCreator
public static DataTypeMapping forValue(String value) {
return new DataTypeMapping(DataType.valueOf(value.toUpperCase()));
}
示例8: forValue
import org.iotp.infomgt.data.kv.DataType; //導入依賴的package包/類
@JsonCreator
public static DataTypeMapping forValue(String value) {
return new DataTypeMapping(DataType.valueOf(value.toUpperCase()));
}