private BatchGetItemOutcome doBatchGetItem(BatchGetItemSpec spec) {
        final Collection<TableKeysAndAttributes> tableKeysAndAttributesCol =
                spec.getTableKeysAndAttributes();
        // Unprocessed keys take precedence
        Map<String, KeysAndAttributes> requestItems = spec.getUnprocessedKeys();
        if (requestItems == null || requestItems.size() == 0) {
            // handle new requests only if there is no unprocessed keys
            requestItems = new LinkedHashMap<String, KeysAndAttributes>();
        } else {
            requestItems = new LinkedHashMap<String, KeysAndAttributes>(requestItems);
        }
        if (tableKeysAndAttributesCol != null) {
            for (TableKeysAndAttributes tableKeysAndAttributes: tableKeysAndAttributesCol) {
                // attributes against one table
                final Set<String> attrNames = tableKeysAndAttributes.getAttributeNames();
                // primary keys against one table
                final List<PrimaryKey> pks = tableKeysAndAttributes.getPrimaryKeys();
                final List<Map<String,AttributeValue>> keys = new ArrayList<Map<String,AttributeValue>>(pks.size());
                for (PrimaryKey pk: pks)
                    keys.add(InternalUtils.toAttributeValueMap(pk));
                final KeysAndAttributes keysAndAttrs = new KeysAndAttributes()
                    .withAttributesToGet(attrNames)
                    .withConsistentRead(tableKeysAndAttributes.isConsistentRead())
                    .withKeys(keys)
                    .withProjectionExpression(tableKeysAndAttributes.getProjectionExpression())
                    .withExpressionAttributeNames(tableKeysAndAttributes.getNameMap())
                    ;
                requestItems.put(tableKeysAndAttributes.getTableName(), keysAndAttrs);
            }
        }
        BatchGetItemRequest req = spec.getRequest()
                                  .withRequestItems(requestItems);
        BatchGetItemResult result = client.batchGetItem(req);
        return new BatchGetItemOutcome(result);
    }
The implementation for <code>BatchGetItemApi</code>.
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/internal/BatchGetItemImpl.java