/* * Copyright 2010-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazon.customerService.model; import com.fasterxml.jackson.annotation.JsonInclude; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey; import java.util.Date; import java.util.Objects; @DynamoDbBean @JsonInclude(JsonInclude.Include.NON_NULL) public class Customer { private String id, name, email, accountNumber; private Date regDate; @DynamoDbPartitionKey @DynamoDbAttribute(value = "Id") public String getId() { return id; } public void setId(String id) { this.id = id; } @DynamoDbAttribute(value = "Name") public String getName() { return name; } public void setName(String name) { this.name = name; } @DynamoDbAttribute(value = "Email") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @DynamoDbAttribute(value = "AccountNumber") public String getAccountNumber() { return accountNumber; } public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } @DynamoDbAttribute(value = "RegistrationDate") public Date getRegDate() { return regDate; } public void setRegDate(Date regDate) { this.regDate = regDate; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Customer customer = (Customer) o; return id.equals(customer.id); } @Override public int hashCode() { return Objects.hash(id); } @Override public String toString() { return "Customer{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", email='" + email + '\'' + ", accountNumber='" + accountNumber + '\'' + ", regDate=" + regDate + '}'; } }