ru.foodtechlab.lib.auth.service.domain.credential.entity.PhoneNumber Maven / Gradle / Ivy
package ru.foodtechlab.lib.auth.service.domain.credential.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import ru.foodtechlab.lib.auth.service.domain.auth.validation.ValidateIsoTwoLetterCountryCode;
import ru.foodtechlab.lib.auth.service.domain.auth.validation.payload.IsoTwoLetterCountryCodeIsIncorrectPayload;
@NoArgsConstructor
@Data
public class PhoneNumber {
private String value;
@ValidateIsoTwoLetterCountryCode(payload = IsoTwoLetterCountryCodeIsIncorrectPayload.class)
private String isoTwoLetterCountryCode;
private boolean isConfirmed;
public PhoneNumber(String value, String isoTwoLetterCountryCode, boolean isConfirmed) {
if (value != null)
this.value = value.replaceAll("[^0-9]", "");
this.isoTwoLetterCountryCode = isoTwoLetterCountryCode;
this.isConfirmed = isConfirmed;
}
public PhoneNumber(String value, String isoTwoLetterCountryCode) {
if (value != null)
this.value = value.replaceAll("[^0-9]", "");
this.isoTwoLetterCountryCode = isoTwoLetterCountryCode;
}
public void setValue(String value) {
if (value != null)
this.value = value.replaceAll("[^0-9]", "");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy