Package org.example.customer.utility
Class Phone
java.lang.Object
org.example.customer.utility.Phone
- All Implemented Interfaces:
Serializable
The Customer Phone for the Customer application.
This class represents the common Phone/Fax field in the Customer Database
This class represents the common Phone/Fax field in the Customer Database
- Version:
- 1.0
- Author:
- Jonathan Earl
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Phone
public Phone()The default constructor for the Phone class.The initial values are:
- number: null
-
Phone
public Phone(org.example.websecurity.XssSanitizer sanitizer) The overloaded constructor for the Phone class that takes an XssSanitizer as input.The initial values are:
- number: null
- Parameters:
sanitizer- the XssSanitizer used by this instance
-
-
Method Details
-
getNumber
Returns the number value for the Phone.- Returns:
- the number value for the Phone
-
setNumber
Sets the number value for the Phone.The business rules are:
- the number may be null
- the number must not be empty
- the number must min length of 2 chars
- the number must max length of 20 chars
- XSS strings within the number will be removed
- Parameters:
number- the value to set into the number field- Throws:
IllegalArgumentException- if the number is invalid
-
hashCode
public int hashCode()The hashCode() method of the Phone class.This method uses:
- number
-
equals
The equals() method of the Phone class.This method uses:
- number
-
toString
The toString method for the Phone class. this method will return:
Phone [Number=XXX]
-