public class Postcode
extends java.lang.Object
Constructor and Description |
---|
Postcode(java.lang.String postcode)
Stores the given postcode and validates it.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getArea()
Reports the postcode area or null if the postcode is invalid.
|
java.lang.String |
getAreaCode()
Reports the part of the postcode that represents the postcode area or null if the postcode is invalid.
|
java.lang.String |
getDistrict()
Reports the postcode district or null if the postcode is invalid.
|
java.lang.String |
getDistrictCode()
Reports the part of the postcode that represents the postcode district or null if the postcode is invalid.
|
java.lang.String |
getErrorMessage()
Reports any error messages associated with an attempt to parse the postcode text.
|
java.lang.String |
getSector()
Reports the postcode sector or null if the postcode is invalid.
|
java.lang.String |
getSectorCode()
Reports the part of the postcode that represents the postcode sector or null if the postcode is invalid.
|
java.lang.String |
getUnit()
Reports the postcode unit or null if the postcode is invalid.
|
java.lang.String |
getUnit7()
Reports a seven digit unit postcode or null if the postcode is invalid.
|
java.lang.String |
getUnitCode()
Reports the part of the postcode that represents the postcode unit or null if the postcode is invalid.
|
boolean |
isValid()
Reports whether the stored postcode is valid.
|
java.lang.String |
toString()
Provides a string representation of the postcode.
|
public Postcode(java.lang.String postcode)
postcode
- Postcode to validate.public boolean isValid()
public java.lang.String getArea()
public java.lang.String getAreaCode()
public java.lang.String getDistrict()
public java.lang.String getDistrictCode()
public java.lang.String getSector()
public java.lang.String getSectorCode()
public java.lang.String getUnit()
public java.lang.String getUnit7()
public java.lang.String getUnitCode()
public java.lang.String getErrorMessage()
public java.lang.String toString()
toString
in class java.lang.Object