Example usage for com.amazonaws.services.dynamodbv2.model AttributeDefinition setAttributeName

List of usage examples for com.amazonaws.services.dynamodbv2.model AttributeDefinition setAttributeName

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model AttributeDefinition setAttributeName.

Prototype


public void setAttributeName(String attributeName) 

Source Link

Document

A name for the attribute.

Usage

From source file:org.apache.gora.dynamodb.store.DynamoDBUtils.java

License:Apache License

/**
 * Builds the necessary requests to create tables
 * /*from   w  w  w  . j a  v  a 2s  .com*/
 * @param tableName
 * @param keySchema
 * @param proThrou
 * @param attrs 
 * @return
 */
public static CreateTableRequest buildCreateTableRequest(String tableName,
        ArrayList<KeySchemaElement> keySchema, ProvisionedThroughput proThrou, Map<String, String> attrs) {
    CreateTableRequest createTableRequest = new CreateTableRequest();
    createTableRequest.setTableName(tableName);
    createTableRequest.setKeySchema(keySchema);
    ArrayList<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>();
    for (KeySchemaElement kEle : keySchema) {
        AttributeDefinition attrDef = new AttributeDefinition();
        attrDef.setAttributeName(kEle.getAttributeName());
        attrDef.setAttributeType(attrs.get(kEle.getAttributeName()));
        attributeDefinitions.add(attrDef);
    }
    createTableRequest.setAttributeDefinitions(attributeDefinitions);
    createTableRequest.setProvisionedThroughput(proThrou);
    return createTableRequest;
}