📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -26,116 +26,36 @@ package com.iluwatar.serverless.baas.model;
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDocument;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* Address class Created by dheeraj.mummarareddy on 3/4/18.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@DynamoDBDocument
|
||||
public class Address implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6760844284799736970L;
|
||||
|
||||
private String addressLineOne;
|
||||
private String addressLineTwo;
|
||||
private String city;
|
||||
private String state;
|
||||
private String zipCode;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "addressLineOne")
|
||||
public String getAddressLineOne() {
|
||||
return addressLineOne;
|
||||
}
|
||||
|
||||
public void setAddressLineOne(String addressLineOne) {
|
||||
this.addressLineOne = addressLineOne;
|
||||
}
|
||||
private String addressLineOne;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "addressLineTwo")
|
||||
public String getAddressLineTwo() {
|
||||
return addressLineTwo;
|
||||
}
|
||||
|
||||
public void setAddressLineTwo(String addressLineTwo) {
|
||||
this.addressLineTwo = addressLineTwo;
|
||||
}
|
||||
private String addressLineTwo;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
private String city;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "state")
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
private String state;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "zipCode")
|
||||
public String getZipCode() {
|
||||
return zipCode;
|
||||
}
|
||||
private String zipCode;
|
||||
|
||||
public void setZipCode(String zipCode) {
|
||||
this.zipCode = zipCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var address = (Address) o;
|
||||
|
||||
if (!Objects.equals(addressLineOne, address.addressLineOne)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(addressLineTwo, address.addressLineTwo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(city, address.city)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(state, address.state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Objects.equals(zipCode, address.zipCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
var result = addressLineOne != null ? addressLineOne.hashCode() : 0;
|
||||
result = 31 * result + (addressLineTwo != null ? addressLineTwo.hashCode() : 0);
|
||||
result = 31 * result + (city != null ? city.hashCode() : 0);
|
||||
result = 31 * result + (state != null ? state.hashCode() : 0);
|
||||
result = 31 * result + (zipCode != null ? zipCode.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Address{"
|
||||
+ "addressLineOne='" + addressLineOne + '\''
|
||||
+ ", addressLineTwo='" + addressLineTwo + '\''
|
||||
+ ", city='" + city + '\''
|
||||
+ ", state='" + state + '\''
|
||||
+ ", zipCode='" + zipCode + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -29,96 +29,35 @@ import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* Person class Created by dheeraj.mummarareddy on 3/4/18.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@DynamoDBTable(tableName = "persons")
|
||||
public class Person implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3413087924608627075L;
|
||||
|
||||
private String id;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private Address address;
|
||||
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
@DynamoDBHashKey(attributeName = "id")
|
||||
@DynamoDBAutoGeneratedKey
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
private String id;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "firstName")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
private String firstName;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "lastName")
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
private String lastName;
|
||||
|
||||
@DynamoDBAttribute(attributeName = "address")
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
private Address address;
|
||||
|
||||
public void setAddress(Address address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Person person = (Person) o;
|
||||
|
||||
if (!Objects.equals(firstName, person.firstName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(lastName, person.lastName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Objects.equals(address, person.address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
var result = firstName != null ? firstName.hashCode() : 0;
|
||||
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
|
||||
result = 31 * result + (address != null ? address.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Person{"
|
||||
+ "id='" + id + '\''
|
||||
+ ", firstName='" + firstName + '\''
|
||||
+ ", lastName='" + lastName + '\''
|
||||
+ ", address=" + address
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,18 @@
|
||||
package com.iluwatar.serverless.faas;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* Lambda context information.
|
||||
*/
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Setter
|
||||
@Getter
|
||||
public class LambdaInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3936130599040848923L;
|
||||
@ -40,103 +47,4 @@ public class LambdaInfo implements Serializable {
|
||||
private String functionVersion;
|
||||
private Integer memoryLimitInMb;
|
||||
|
||||
public String getAwsRequestId() {
|
||||
return awsRequestId;
|
||||
}
|
||||
|
||||
public void setAwsRequestId(String awsRequestId) {
|
||||
this.awsRequestId = awsRequestId;
|
||||
}
|
||||
|
||||
public String getLogGroupName() {
|
||||
return logGroupName;
|
||||
}
|
||||
|
||||
public void setLogGroupName(String logGroupName) {
|
||||
this.logGroupName = logGroupName;
|
||||
}
|
||||
|
||||
public String getLogStreamName() {
|
||||
return logStreamName;
|
||||
}
|
||||
|
||||
public void setLogStreamName(String logStreamName) {
|
||||
this.logStreamName = logStreamName;
|
||||
}
|
||||
|
||||
public String getFunctionName() {
|
||||
return functionName;
|
||||
}
|
||||
|
||||
public void setFunctionName(String functionName) {
|
||||
this.functionName = functionName;
|
||||
}
|
||||
|
||||
public String getFunctionVersion() {
|
||||
return functionVersion;
|
||||
}
|
||||
|
||||
public void setFunctionVersion(String functionVersion) {
|
||||
this.functionVersion = functionVersion;
|
||||
}
|
||||
|
||||
public Integer getMemoryLimitInMb() {
|
||||
return memoryLimitInMb;
|
||||
}
|
||||
|
||||
public void setMemoryLimitInMb(Integer memoryLimitInMb) {
|
||||
this.memoryLimitInMb = memoryLimitInMb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LambdaInfo{"
|
||||
+ "awsRequestId='" + awsRequestId + '\''
|
||||
+ ", logGroupName='" + logGroupName + '\''
|
||||
+ ", logStreamName='" + logStreamName + '\''
|
||||
+ ", functionName='" + functionName + '\''
|
||||
+ ", functionVersion='" + functionVersion + '\''
|
||||
+ ", memoryLimitInMb=" + memoryLimitInMb
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LambdaInfo that = (LambdaInfo) o;
|
||||
|
||||
if (!Objects.equals(awsRequestId, that.awsRequestId)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(logGroupName, that.logGroupName)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(logStreamName, that.logStreamName)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(functionName, that.functionName)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(functionVersion, that.functionVersion)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(memoryLimitInMb, that.memoryLimitInMb);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
var result = awsRequestId != null ? awsRequestId.hashCode() : 0;
|
||||
result = 31 * result + (logGroupName != null ? logGroupName.hashCode() : 0);
|
||||
result = 31 * result + (logStreamName != null ? logStreamName.hashCode() : 0);
|
||||
result = 31 * result + (functionName != null ? functionName.hashCode() : 0);
|
||||
result = 31 * result + (functionVersion != null ? functionVersion.hashCode() : 0);
|
||||
result = 31 * result + (memoryLimitInMb != null ? memoryLimitInMb.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user