io.sphere.sdk.customers.CustomerImpl Maven / Gradle / Ivy
package io.sphere.sdk.customers;
import io.sphere.sdk.customergroups.CustomerGroup;
import io.sphere.sdk.models.Address;
import io.sphere.sdk.models.DefaultModelImpl;
import io.sphere.sdk.models.Reference;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import java.time.LocalDate;
class CustomerImpl extends DefaultModelImpl implements Customer {
private final Optional customerNumber;
private final String email;
private final String firstName;
private final String lastName;
private final String password;
private final Optional middleName;
private final Optional title;
private final List addresses;
private final Optional defaultShippingAddressId;
private final Optional defaultBillingAddressId;
private final boolean isEmailVerified;
private final Optional externalId;
private final Optional> customerGroup;
private final Optional companyName;
private final Optional vatId;
private final Optional dateOfBirth;
public CustomerImpl(final String id, final long version, final Instant createdAt, final Instant lastModifiedAt, final Optional customerNumber, final String email, final String firstName, final String lastName, final String password, final Optional middleName, final Optional title, final List addresses, final Optional defaultShippingAddressId, final Optional defaultBillingAddressId, final boolean isEmailVerified, final Optional externalId, final Optional> customerGroup, final Optional companyName, final Optional vatId, final Optional dateOfBirth) {
super(id, version, createdAt, lastModifiedAt);
this.customerNumber = customerNumber;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.password = password;
this.middleName = middleName;
this.title = title;
this.addresses = addresses;
this.defaultShippingAddressId = defaultShippingAddressId;
this.defaultBillingAddressId = defaultBillingAddressId;
this.isEmailVerified = isEmailVerified;
this.externalId = externalId;
this.customerGroup = customerGroup;
this.companyName = companyName;
this.vatId = vatId;
this.dateOfBirth = dateOfBirth;
}
@Override
public Optional getCustomerNumber() {
return customerNumber;
}
@Override
public String getEmail() {
return email;
}
@Override
public String getFirstName() {
return firstName;
}
@Override
public String getLastName() {
return lastName;
}
@Override
public String getPassword() {
return password;
}
@Override
public Optional getMiddleName() {
return middleName;
}
@Override
public Optional getTitle() {
return title;
}
@Override
public List getAddresses() {
return addresses;
}
@Override
public Optional getDefaultShippingAddressId() {
return defaultShippingAddressId;
}
@Override
public Optional getDefaultBillingAddressId() {
return defaultBillingAddressId;
}
@Override
public boolean isEmailVerified() {
return isEmailVerified;
}
@Override
public Optional getExternalId() {
return externalId;
}
@Override
public Optional> getCustomerGroup() {
return customerGroup;
}
@Override
public Optional getCompanyName() {
return companyName;
}
@Override
public Optional getVatId() {
return vatId;
}
@Override
public Optional getDateOfBirth() {
return dateOfBirth;
}
//it is final to prevent subclasses to log the password
@Override
public final String toString() {
final Customer out = new CustomerImpl(getId(), getVersion(), getCreatedAt(), getLastModifiedAt(),
customerNumber, email, firstName, lastName, "**removed from output**", middleName,
title, addresses, defaultShippingAddressId, defaultBillingAddressId,
isEmailVerified, externalId, customerGroup, companyName, vatId, dateOfBirth);
return ToStringBuilder.reflectionToString(out);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy