public class PhoneNumber extends java.lang.Object implements ContactMethod
Constructor and Description |
---|
PhoneNumber(java.lang.String phoneNumber)
Constructor by Phone number.
|
PhoneNumber(java.lang.String phoneNumber,
boolean verified)
Constructor by Phone number and Verified value.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAreaCode()
Getter for the 3 digits Area Code of the Phone Number.
|
java.lang.String |
getFormatted()
Returns the Phone Number in format (123) 456-7890.
|
java.lang.String |
getMasked()
Returns the Phone Number in masked format (***) ***-7890.
|
java.lang.String |
getType()
Getter for the class type.
|
java.lang.String |
getValue()
Returns the Phone Number value.
|
boolean |
isEmpty()
Indicates if the Phone Number is empty.
|
boolean |
isValid()
Match the pattern for a 10 digits Phone Number.
|
boolean |
isVerified()
Indicates if the Phone Number is verified.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isEmpty
public PhoneNumber(java.lang.String phoneNumber)
Will validate if the provided Phone Number is not Empty, if so, it will remove all characters except numbers from it (Cleansing).
phoneNumber
- The Phone Number.public PhoneNumber(java.lang.String phoneNumber, boolean verified)
Will validate if the provided Phone Number is not Empty, if so, it will remove all characters except numbers from it (Cleansing).
phoneNumber
- The Phone Number.verified
- Indicates if the Phone Number is Verified.public java.lang.String getFormatted()
getFormatted
in interface ContactMethod
public java.lang.String getMasked()
getMasked
in interface ContactMethod
public java.lang.String getValue()
getValue
in interface ContactMethod
public boolean isVerified()
isVerified
in interface ContactMethod
public boolean isEmpty()
isEmpty
in interface ContactMethod
public boolean isValid()
isValid
in interface ContactMethod
public java.lang.String getType()
getType
in interface ContactMethod
public java.lang.String getAreaCode()
public java.lang.String toString()
toString
in class java.lang.Object