1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  *  http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 package software.amazon.awssdk.enhanced.dynamodb.mapper.testbeans;
17 
18 import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean;
19 import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey;
20 import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSecondaryPartitionKey;
21 import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSecondarySortKey;
22 import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSortKey;
23 
24 /**
25  * A bean with a global secondary index that uses the same partition key as the table.
26  */
27 @DynamoDbBean
28 public class SecondaryIndexMatchingTableKeyBean {
29     private String id;
30     private Integer sort;
31     private String attribute;
32 
33     @DynamoDbPartitionKey
34     @DynamoDbSecondaryPartitionKey(indexNames = "gsi")
getId()35     public String getId() {
36         return this.id;
37     }
38 
setId(String id)39     public void setId(String id) {
40         this.id = id;
41     }
42 
43     @DynamoDbSortKey
getSort()44     public Integer getSort() {
45         return sort;
46     }
47 
setSort(Integer sort)48     public void setSort(Integer sort) {
49         this.sort = sort;
50     }
51 
52     @DynamoDbSecondarySortKey(indexNames = "gsi")
getAttribute()53     public String getAttribute() {
54         return attribute;
55     }
56 
setAttribute(String attribute)57     public void setAttribute(String attribute) {
58         this.attribute = attribute;
59     }
60 }
61