setStreamViewType(streamViewType); return this;
streamSpecification.setStreamViewType(context.getUnmarshaller(String.class).unmarshall(context));
public StreamSpecification unmarshall(JsonUnmarshallerContext context) throws Exception { AwsJsonReader reader = context.getReader(); if (!reader.isContainer()) { reader.skipValue(); return null; } StreamSpecification streamSpecification = new StreamSpecification(); reader.beginObject(); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("StreamEnabled")) { streamSpecification.setStreamEnabled(BooleanJsonUnmarshaller.getInstance() .unmarshall(context)); } else if (name.equals("StreamViewType")) { streamSpecification.setStreamViewType(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } else { reader.skipValue(); } } reader.endObject(); return streamSpecification; }
setStreamViewType(streamViewType); return this;
/** * @return StreamArn */ public static String createTable(AmazonDynamoDBClient client, String tableName) { java.util.List<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>(); attributeDefinitions.add(new AttributeDefinition().withAttributeName("Id").withAttributeType("N")); java.util.List<KeySchemaElement> keySchema = new ArrayList<KeySchemaElement>(); keySchema.add(new KeySchemaElement().withAttributeName("Id").withKeyType(KeyType.HASH)); ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput() .withReadCapacityUnits(2L).withWriteCapacityUnits(2L); StreamSpecification streamSpecification = new StreamSpecification(); streamSpecification.setStreamEnabled(true); streamSpecification.setStreamViewType(StreamViewType.NEW_IMAGE); CreateTableRequest createTableRequest = new CreateTableRequest() .withTableName(tableName) .withAttributeDefinitions(attributeDefinitions) .withKeySchema(keySchema) .withProvisionedThroughput(provisionedThroughput) .withStreamSpecification(streamSpecification); try { System.out.println("Creating table " + tableName); CreateTableResult result = client.createTable(createTableRequest); return result.getTableDescription().getLatestStreamArn(); } catch(ResourceInUseException e) { System.out.println("Table already exists."); return describeTable(client, tableName).getTable().getLatestStreamArn(); } }
streamSpecification.setStreamViewType(context.getUnmarshaller(String.class).unmarshall(context));
streamSpecification.setStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES);