ddb.getItem(request).item(); if (returned_item != null) { Set<String> keys = returned_item.keySet();
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetItemResponse)) { return false; } GetItemResponse other = (GetItemResponse) obj; return Objects.equals(item(), other.item()) && Objects.equals(consumedCapacity(), other.consumedCapacity()); }
@Override public GetItemResponse build() { return new GetItemResponse(this); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(item()); hashCode = 31 * hashCode + Objects.hashCode(consumedCapacity()); return hashCode; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("GetItemResponse").add("Item", item()).add("ConsumedCapacity", consumedCapacity()).build(); }
/** * Retrieves the lock item from DynamoDB. Note that this will return a * LockItem even if it was released -- do NOT use this method if your goal * is to acquire a lock for doing work. * * @param options The options such as the key, etc. * @return The LockItem, or absent if it is not present. Note that the item * can exist in the table even if it is released, as noted by * isReleased(). */ public Optional<LockItem> getLockFromDynamoDB(final GetLockOptions options) { Objects.requireNonNull(options, "AcquireLockOptions cannot be null"); Objects.requireNonNull(options.getPartitionKey(), "Cannot lookup null key"); final GetItemResponse result = this.readFromDynamoDB(options.getPartitionKey(), options.getSortKey()); final Map<String, AttributeValue> item = result.item(); if (item == null || item.isEmpty()) { return Optional.empty(); } return Optional.of(this.createLockItem(options, item)); }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "Item": return Optional.ofNullable(clazz.cast(item())); case "ConsumedCapacity": return Optional.ofNullable(clazz.cast(consumedCapacity())); default: return Optional.empty(); } }
GetItemResponse result = dynamoDBClient.getItem(request).get(); Map<String, AttributeValue> dynamoRecord = result.item(); if (CollectionUtils.isNullOrEmpty(dynamoRecord)) { log.debug("No lease found with key {}, returning null.", leaseKey);
GetItemResponse result = dynamoDBClient.getItem(request).get(); Map<String, AttributeValue> dynamoRecord = result.item(); if (CollectionUtils.isNullOrEmpty(dynamoRecord)) { log.debug("No lease found with key {}, returning null.", leaseKey);