本文整理汇总了Java中com.amazonaws.services.dynamodbv2.document.Table.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getItem方法的具体用法?Java Table.getItem怎么用?Java Table.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.dynamodbv2.document.Table
的用法示例。
在下文中一共展示了Table.getItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readState
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
@Override
public StorageTestState readState(final String identity)
{
final Table table = dynamoDBConnection.getDynamoDB().getTable(getTableName());
final Item item = table.getItem("_id", generateItemId(identity));
if (item != null)
{
try
{
final StorageTestState testState = new HelloState();
dynamoDBConnection.getMapper().readerForUpdating(testState).readValue(item.getJSON("_state"));
return testState;
}
catch (Exception e)
{
throw new UncheckedException(e);
}
}
return null;
}
示例2: retrieveItem
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public static void retrieveItem(String threadId, String replyDateTime) throws IOException {
Table table = dynamoDB.getTable(tableName);
GetItemSpec spec = new GetItemSpec()
.withPrimaryKey("Id", threadId, "ReplyDateTime", replyDateTime)
.withConsistentRead(true);
Item item = table.getItem(spec);
// Uncompress the reply message and print
String uncompressed = uncompressString(ByteBuffer.wrap(item.getBinary("ExtendedMessage")));
System.out.println("Reply message:\n"
+ " Id: " + item.getString("Id") + "\n"
+ " ReplyDateTime: " + item.getString("ReplyDateTime") + "\n"
+ " PostedBy: " + item.getString("PostedBy") + "\n"
+ " Message: " + item.getString("Message") + "\n"
+ " ExtendedMessage (uncompressed): " + uncompressed + "\n");
}
示例3: readLatestVersion
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public long readLatestVersion() {
Table table = dynamoDB.getTable(tableName);
Item item = table.getItem("namespace", blobNamespace,
"version, pin_version", null);
if (item.isPresent("pin_version") && !item.isNull("pin_version"))
return item.getLong("pin_version");
return item.getLong("version");
}
示例4: readOwningType
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public String readOwningType(final String identity)
{
final Table table = dynamoDBConnection.getDynamoDB().getTable(getTableName());
final Item item = table.getItem("_id", generateItemId(identity));
if (item != null)
{
return item.getString(DynamoDBUtils.FIELD_NAME_OWNING_ACTOR_TYPE);
}
return null;
}
示例5: getConfigItem
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public Item getConfigItem() {
Regions currentRegion = getDeploymentRegion();
AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient().withRegion(currentRegion);
String configTableName = getConfigTableName(context.getFunctionName());
Table configTable = new DynamoDB(dynamoDBClient).getTable(configTableName);
String environment = getFunctionNameEnvironmentSuffix().orElse(DEFAULT_ENVIRONMENT);
System.out.println("Looking up config table : " + configTableName + " for config by key: "+environment);
return configTable.getItem(CONFIG_TABLE_KEY_NAME, environment);
}
示例6: getItem
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private Item getItem(String group, String key, Table table) {
return table.getItem(HASH_KEY, group, RANGE_KEY, key);
}
示例7: retrieveItem
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private static void retrieveItem() {
Table table = dynamoDB.getTable(tableName);
try {
Item item = table.getItem("Id", 120, "Id, ISBN, Title, Authors", null);
System.out.println("Printing item after retrieving it....");
System.out.println(item.toJSONPretty());
} catch (Exception e) {
System.err.println("GetItem failed.");
System.err.println(e.getMessage());
}
}
示例8: getBook
import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private static void getBook(int id, String tableName) {
Table table = dynamoDB.getTable(tableName);
Item item = table.getItem("Id", // attribute name
id, // attribute value
"Id, ISBN, Title, Authors", // projection expression
null); // name map - don't need this
System.out.println("GetItem: printing results...");
System.out.println(item.toJSONPretty());
}