|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--postalcode.PostalCode
This class is the superclass which defines the basics of any postal code. Some methods are abstract and must be overriden.
Field Summary | |
private java.lang.String |
code
The postal code to be analysed. |
private java.lang.String |
destination
The destination location of the postal code. |
private boolean |
hasBeenValidated
Whether the code has been validated. |
private boolean |
isValid
Once validated, whether the code is valid or not. |
Constructor Summary | |
PostalCode(java.lang.String code)
Constructs a postal code object using information passed by the subclass constructors. |
Method Summary | |
java.lang.String |
getCode()
Retrieves the postal code. |
abstract java.lang.String |
getCountry()
This method returns the country of origin of the postal code. |
java.lang.String |
getDestination()
Retrieves the postal code's destination. |
boolean |
isValid()
Verifies if the postal is valid. |
void |
setDestination(java.lang.String destination)
Sets the postal code's destination. |
(package private) void |
throwException(java.lang.String message)
This method will cause an exception to be thrown. |
java.lang.String |
toString()
General information about this object. |
protected abstract void |
validate()
This method is used to verify the validity of a postal code. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.lang.String code
private boolean hasBeenValidated
private boolean isValid
private java.lang.String destination
Constructor Detail |
public PostalCode(java.lang.String code) throws PostalCodeException
code
- The postal code to be analysed.Method Detail |
public java.lang.String toString()
public java.lang.String getCode()
public java.lang.String getDestination()
public void setDestination(java.lang.String destination)
destination
- The postal code's destination.public boolean isValid() throws PostalCodeException
void throwException(java.lang.String message) throws PostalCodeException
message
- The detailed message about the cause of the
exception.protected abstract void validate() throws PostalCodeException
public abstract java.lang.String getCountry()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |