Record Class PhoneNr
java.lang.Object
java.lang.Record
net.tangly.core.PhoneNr
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static booleanValidates a phone number using the Google phone library.@NotNull Stringnumber()Returns the value of thenumberrecord component.static PhoneNrFactory method to of a new phone number.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PhoneNr
Creates an instance of aPhoneNrrecord class.- Parameters:
number- the value for thenumberrecord component
-
-
Method Details
-
of
Factory method to of a new phone number. The number is formatted based on the international format standard.- Parameters:
number- phone number in a raw format- Returns:
- the newly created phone number if the raw format contained a number otherwise null
-
isValid
Validates a phone number using the Google phone library.- Parameters:
number- phone number to validate- Returns:
- true, if the phone number is valid otherwise false
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
number
Returns the value of thenumberrecord component.- Returns:
- the value of the
numberrecord component
-