/** * Returns an <code>Item</code> given the low level item information; * or null if the input is null; */ public static Item toItem(Map<String, AttributeValue> item) { if (item == null) { return null; } return Item.fromMap(toSimpleMapValue(item)); }
/** * Converts the specified primary key into the low-level representation. */ public static Map<String, AttributeValue> toAttributeValueMap( PrimaryKey primaryKey) { if (primaryKey == null) return null; return toAttributeValueMap(primaryKey.getComponents()); }
/** * Adds a hash-only primary key to be included in the batch get-item * operation. * * @param hashKeyName name of the hash key attribute name * @param hashKeyValue name of the hash key value * @return the current instance for method chaining purposes */ public TableKeysAndAttributes addHashOnlyPrimaryKey( String hashKeyName, Object hashKeyValue) { this.addPrimaryKey(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
/** * Adds a hash-only primary key to be deleted in a batch write * operation. * * @param hashKeyName name of the hash key attribute name * @param hashKeyValue name of the hash key value * @return the current instance for method chaining purposes */ public TableWriteItems addHashOnlyPrimaryKeyToDelete( String hashKeyName, Object hashKeyValue) { this.addPrimaryKeyToDelete(new PrimaryKey(hashKeyName, hashKeyValue)); return this; }
/** * Creates and returns a condition of the range key that has a value between * the given values. */ public Expected between(Object low, Object hi) { return _withComparisonOperator(ComparisonOperator.BETWEEN)._withValues(low, hi); }
/** * Convenient method to set the attributes of this item from the given * hash and range primary key. */ public Item withPrimaryKey(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue) { return withKeyComponent(hashKeyName, hashKeyValue) .withKeyComponent(rangeKeyName, rangeKeyValue); }
/** * Returns the specified DynamoDB table. No network call is involved. */ public Table getTable(String tableName) { return new Table(client, tableName); }
/** * Convenient methods - sets an attribute of this item for the specified * key attribute name and value. */ public Item withKeyComponent(String keyAttrName, Object keyAttrValue) { return with(keyAttrName, keyAttrValue); }
public QuerySpec withExclusiveStartKey(PrimaryKey exclusiveStartKey) { if (exclusiveStartKey == null) this.exclusiveStartKey = null; else { this.exclusiveStartKey = exclusiveStartKey.getComponents(); } return this; }
/** * Converts an <code>Item</code> into the low-level representation; * or null if the input is null. */ public static Map<String, AttributeValue> toAttributeValues(Item item) { return ItemUtils.toAttributeValues(item); }
/** * Returns the minimum of the two input integers taking null into account. * Returns null if both integers are null. Otherwise, a null Integer is * treated as infinity. */ public static Integer minimum(Integer one, Integer two) { return ItemUtils.minimum(one, two); }
/** * Returns the low level representation of a collection of <code>Expected</code>. */ public static Map<String, ExpectedAttributeValue> toExpectedAttributeValueMap( Collection<Expected> expectedSet) { return ItemUtils.toExpectedAttributeValueMap(expectedSet); }
/** * Constructs with a hash key. */ public PrimaryKey(String hashKeyName, Object hashKeyValue) { addComponent(hashKeyName, hashKeyValue); }
/** * Returns a non-null list of <code>Item</code>'s given the low level * list of item information. */ public static List<Item> toItemList(List<Map<String, AttributeValue>> items) { return ItemUtils.toItemList(items); }
/** * Gets a reference to the specified index. No network call. */ public Index getIndex(String indexName) { return new Index(client, indexName, this); }
/** * Expects the attribute be an existing attribute. */ public Expected exists() { return _withComparisonOperator(ComparisonOperator.NOT_NULL); }
/** * Creates and returns a condition of the range key with a value that begins * with the given value. */ public RangeKeyCondition beginsWith(String val) { kcond = KeyConditions.BEGINS_WITH; return withValues(val); } /**
/** * Creates and returns a condition of the range key being less than the * given value. */ public Expected lt(Object val) { return _withComparisonOperator(ComparisonOperator.LT)._withValues(val); } }
/** * @see ScanRequest#withExclusiveStartKey(Map) */ public ScanSpec withExclusiveStartKey(PrimaryKey exclusiveStartKey) { if (exclusiveStartKey == null) this.exclusiveStartKey = null; else { this.exclusiveStartKey = exclusiveStartKey.getComponents(); } return this; }
/** * Creates and returns a condition of the range key with a value that begins * with the given value. */ public Expected beginsWith(String val) { return _withComparisonOperator(ComparisonOperator.BEGINS_WITH)._withValues(val); }