/** * 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); }
/** * Convenient factory method - instantiates an <code>Item</code> from the * given map. * * @param attributes * simple Java types; not the DyanmoDB types */ public static Item fromMap(Map<String, Object> attributes) { if (attributes == null) return null; Item item = new Item(); for (Map.Entry<String, Object> e : attributes.entrySet()) item.with(e.getKey(), e.getValue()); return item; }
/** * Convenient methods - sets the attributes of this item from the given * key attributes. */ public Item withPrimaryKey(PrimaryKey primaryKey) { rejectNullValue(primaryKey); if (primaryKey.getComponents().size() == 0) throw new IllegalArgumentException("primary key must not be empty"); for (KeyAttribute ka: primaryKey.getComponents()) this.with(ka.getName(), ka.getValue()); return this; }
/** * Convenient methods - sets the attributes of this item from the specified * key components. */ public Item withKeyComponents(KeyAttribute ...components) { rejectNullOrEmptyInput(components); for (KeyAttribute ka: components) { rejectNullValue(ka); this.with(ka.getName(), ka.getValue()); } return this; }
/** * 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); }
/** * Convenient factory method - instantiates an <code>Item</code> from the * given map. * * @param attributes * simple Java types; not the DyanmoDB types */ public static Item fromMap(Map<String, Object> attributes) { if (attributes == null) return null; Item item = new Item(); for (Map.Entry<String, Object> e : attributes.entrySet()) item.with(e.getKey(), e.getValue()); return item; }
/** * Convenient methods - sets the attributes of this item from the given * key attributes. */ public Item withPrimaryKey(PrimaryKey primaryKey) { rejectNullValue(primaryKey); if (primaryKey.getComponents().size() == 0) throw new IllegalArgumentException("primary key must not be empty"); for (KeyAttribute ka: primaryKey.getComponents()) this.with(ka.getName(), ka.getValue()); return this; }
/** * Convenient methods - sets the attributes of this item from the specified * key components. */ public Item withKeyComponents(KeyAttribute ...components) { rejectNullOrEmptyInput(components); for (KeyAttribute ka: components) { rejectNullValue(ka); this.with(ka.getName(), ka.getValue()); } return this; }
public TableRow rowWithJsonbFromDynamoRecord(Map<String,AttributeValue> dynamoItem) { TableRow row = tableSchema.createRow(); Item item = new Item(); for(Map.Entry<String, AttributeValue> entry : dynamoItem.entrySet()) { String keyName = entry.getKey(); String columnName = dynamoKeyToColumnName(keyName); TableColumn column = tableSchema.getColumn(columnName); AttributeValue typedValue = entry.getValue(); TableColumnValue columnValue = columnValueFromDynamoValue(typedValue); if (column != null) { row.setValue(columnName, columnValue); } item.with(keyName, columnValue.datum); } row.setValue("data", item.toJSON()); return row; }