本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.GetItemRequest.setTableName方法的典型用法代码示例。如果您正苦于以下问题:Java GetItemRequest.setTableName方法的具体用法?Java GetItemRequest.setTableName怎么用?Java GetItemRequest.setTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.dynamodbv2.model.GetItemRequest
的用法示例。
在下文中一共展示了GetItemRequest.setTableName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPoint
import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
public GetPointResult getPoint(GetPointRequest getPointRequest) {
long geohash = S2Manager.generateGeohash(getPointRequest.getGeoPoint());
long hashKey = S2Manager.generateHashKey(geohash, config.getHashKeyLength());
GetItemRequest getItemRequest = getPointRequest.getGetItemRequest();
getItemRequest.setTableName(config.getTableName());
AttributeValue hashKeyValue = new AttributeValue().withN(String.valueOf(hashKey));
getItemRequest.getKey().put(config.getHashKeyAttributeName(), hashKeyValue);
getItemRequest.getKey().put(config.getRangeKeyAttributeName(), getPointRequest.getRangeKeyValue());
GetItemResult getItemResult = config.getDynamoDBClient().getItem(getItemRequest);
GetPointResult getPointResult = new GetPointResult(getItemResult);
return getPointResult;
}
示例2: getItemResultMono
import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
private Mono<GetItemResult> getItemResultMono(String url) {
GetItemRequest getItemRequest = new GetItemRequest();
getItemRequest.setTableName(Utils.table.websites);
HashMap<String, AttributeValue> key = new HashMap<>();
key.put(Utils.params.url, new AttributeValue(url));
getItemRequest.setKey(key);
return Mono.fromFuture(
Utils.makeCompletableFuture(
dynamoDBAsync.getItemAsync(getItemRequest)))
.doOnError((throwable -> LOG.error(Utils.error.failed_dynamo_get, url)));
}
示例3: getItemRequest
import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
private GetItemRequest getItemRequest(String url) {
GetItemRequest request = new GetItemRequest();
request.setTableName(Utils.table.websites);
HashMap<String, AttributeValue> key = new HashMap<>();
key.put(Utils.params.url, new AttributeValue(url));
request.setKey(key);
return request;
}
示例4: makeItemRequestFor
import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
/**
* Makes a GetItemRequest for a given attribute.
* @param attr Attribute name
* @return GetItemRequest
*/
private GetItemRequest makeItemRequestFor(final String attr) {
final GetItemRequest request = new GetItemRequest();
request.setTableName(this.name);
request.setAttributesToGet(Collections.singletonList(attr));
request.setKey(this.attributes.only(this.keys));
request.setReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL);
request.setConsistentRead(true);
return request;
}
示例5: findOne
import com.amazonaws.services.dynamodbv2.model.GetItemRequest; //导入方法依赖的package包/类
@Override
public <T extends Message> T findOne(T matcher, Modifier... modifiers) throws DataStoreException {
DynamoClassMapping<T> tableInfo = getClassMapping(matcher);
log.debug("findOne {} {}", matcher.getClass().getSimpleName(), matcher);
Map<FieldDescriptor, Object> matcherFields = matcher.getAllFields();
// TODO: Remove PK fields
GetItemRequest request = new GetItemRequest();
// TODO: Modifier for eventually consistent read?
request.setConsistentRead(true);
request.setTableName(tableInfo.getDynamoTableName());
request.setKey(tableInfo.buildCompleteKey(matcher));
for (Modifier modifier : modifiers) {
throw new UnsupportedOperationException();
}
GetItemResult result = dynamoDB.getItem(request);
Map<String, AttributeValue> itemData = result.getItem();
if (itemData == null) {
return null;
}
T item = tableInfo.mapFromDb(itemData);
if (DataStore.matches(matcherFields, item)) {
log.debug("found item: {}", item);
return item;
}
return null;
}