Package com.verisign.epp.codec.contact
Class EPPContactAddress
- java.lang.Object
-
- com.verisign.epp.codec.contact.EPPContactAddress
-
- All Implemented Interfaces:
EPPCodecComponent
,java.io.Serializable
,java.lang.Cloneable
public class EPPContactAddress extends java.lang.Object implements EPPCodecComponent
Represents a contact address specified inEPPContactCreateCmd
,EPPContactUpdateCmd
, orEPPContactInfoResp
. Every contact has associated postal address information. A postal address contains OPTIONAL street information, city information, OPTIONAL state/province information, an OPTIONAL postal code, and a country identifier as described in [ISO11180]. Address information MAY be provided in both a subset of UTF-8 [RFC2279] that can be represented in 7-bit ASCII [US-ASCII] and unrestricted UTF-8. A contact address is defined as the following in the EPP Contact Mapping Specification:
A <contact:addr> element that contains address information associated with the contact. A <contact:addr> element contains the following child elements:
- OPTIONAL <contact:street> elements (up to a maximum of three) that contain the contact's street address.
Use
getStreets
andsetStreets
to get and set the elements. - A <contact:city> element that contains the contact's city. Use
getCity
andsetCity
to get and set the element. - A <contact:sp> element that contains the contact's state or province. This element is OPTIONAL for
addressing schemes that do not require a state or province name. Use
getStateProvince
andsetStateProvince
to get and set the element. - An OPTIONAL <contact:pc> element that contains the contact's postal code. Use
getPostalCode
andsetPostalCode
to get and set the element. - A <contact:cc> element that contains the two-character identifier representing with the contact's country.
Use
getCountry
andsetCountry
to get and set the element.
-
-
Constructor Summary
Constructors Constructor Description EPPContactAddress()
Default constructor forEPPContactAddress
.EPPContactAddress(java.lang.String aCity, java.lang.String aCountry)
Constructor forEPPContactAddress
all of the required attributes as parameters.EPPContactAddress(java.util.Vector someStreets, java.lang.String aCity, java.lang.String aStateProvince, java.lang.String aPostalCode, java.lang.String aCountry)
Constructor forEPPContactAddress
all of the required attributes as parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
CloneEPPContactAddress
.void
decode(org.w3c.dom.Element aElement)
Decode theEPPContactAddress
attributes from the aElement DOM Element tree.org.w3c.dom.Element
encode(org.w3c.dom.Document aDocument)
Encode a DOM Element tree from the attributes of theEPPContactAddress
instance.boolean
equals(java.lang.Object aObject)
implements a deepEPPContactAddress
compare.java.lang.String
getCity()
Gets the contact city.java.lang.String
getCountry()
Gets the contact country.java.lang.String
getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.java.lang.String
getPostalCode()
Gets the contact postal codejava.lang.String
getStateProvince()
Gets the contact state/province.java.util.Vector
getStreets()
Gets the contact street(s).boolean
hasCity()
Returnstrue
if the address has city.boolean
hasCountry()
Returnstrue
if the address has country.boolean
hasPostalCode()
Returnstrue
if the address has postal code.boolean
hasStateProvince()
Returnstrue
if the address has state.boolean
hasStreets()
Returnstrue
if the address has at least one street.void
setCity(java.lang.String aCity)
Sets the contact city.void
setCountry(java.lang.String aCountry)
Sets the contact country.void
setPostalCode(java.lang.String aPostalCode)
Sets the contact postal codevoid
setStateProvince(java.lang.String aStateProvince)
Sets the contact state/province.void
setStreet(java.lang.String aStreet)
Sets the contact street with only oneString
parameter.void
setStreets(java.lang.String aStreet1, java.lang.String aStreet2)
Sets the contact street with two sub-streetString
's.void
setStreets(java.lang.String aStreet1, java.lang.String aStreet2, java.lang.String aStreet3)
Sets the contact street with three sub-streetString
's.void
setStreets(java.util.Vector someStreets)
Sets the contact street attribute with aVector
ofString
's.java.lang.String
toString()
Implementation oftoString
, which will result in an indented XMLString
representation of the concreteEPPCodecComponent
.
-
-
-
Constructor Detail
-
EPPContactAddress
public EPPContactAddress()
Default constructor forEPPContactAddress
. All the the attributes default tonull
. Must call required setter methods before invokingencode
, which include:
- city -
setCity
- country -
setCountry
- city -
-
EPPContactAddress
public EPPContactAddress(java.lang.String aCity, java.lang.String aCountry)
Constructor forEPPContactAddress
all of the required attributes as parameters.- Parameters:
aCity
- contact streetaCountry
- contract country
-
EPPContactAddress
public EPPContactAddress(java.util.Vector someStreets, java.lang.String aCity, java.lang.String aStateProvince, java.lang.String aPostalCode, java.lang.String aCountry)
Constructor forEPPContactAddress
all of the required attributes as parameters.- Parameters:
someStreets
-Vector
of street (up to maximum three)String
'saCity
- contact streetaStateProvince
- contact state/provinceaPostalCode
- contact postal codeaCountry
- contract country
-
-
Method Detail
-
getStreets
public java.util.Vector getStreets()
Gets the contact street(s).- Returns:
- street(s) as a
Vector
of street (up to maximum three)String
if defined;null
otherwise.
-
hasStreets
public boolean hasStreets()
Returnstrue
if the address has at least one street.- Returns:
true
if the address at least one streetfalse
otherwise
-
setStreet
public void setStreet(java.lang.String aStreet)
Sets the contact street with only oneString
parameter. Only a one elementVector
will be returned on a call togetStreets
when originally set with this method.- Parameters:
aStreet
- contact street.
-
setStreets
public void setStreets(java.util.Vector someStreets)
Sets the contact street attribute with aVector
ofString
's.- Parameters:
someStreets
-Vector
of one or two streetString
's.
-
setStreets
public void setStreets(java.lang.String aStreet1, java.lang.String aStreet2)
Sets the contact street with two sub-streetString
's.- Parameters:
aStreet1
- First part/line of contact streetaStreet2
- Second part/line of contact street
-
setStreets
public void setStreets(java.lang.String aStreet1, java.lang.String aStreet2, java.lang.String aStreet3)
Sets the contact street with three sub-streetString
's.- Parameters:
aStreet1
- First part/line of contact streetaStreet2
- Second part/line of contact streetaStreet3
- Third part/line of contact street
-
getCity
public java.lang.String getCity()
Gets the contact city.- Returns:
- city.
String
if defined;null
otherwise.
-
hasCity
public boolean hasCity()
Returnstrue
if the address has city.- Returns:
true
if the address has cityfalse
otherwise
-
setCity
public void setCity(java.lang.String aCity)
Sets the contact city.- Parameters:
aCity
- contact city
-
getStateProvince
public java.lang.String getStateProvince()
Gets the contact state/province.- Returns:
- state/province.
String
if defined;null
otherwise.
-
hasStateProvince
public boolean hasStateProvince()
Returnstrue
if the address has state.- Returns:
true
if the address has statefalse
otherwise
-
setStateProvince
public void setStateProvince(java.lang.String aStateProvince)
Sets the contact state/province.- Parameters:
aStateProvince
- contact state/province
-
getPostalCode
public java.lang.String getPostalCode()
Gets the contact postal code- Returns:
- postal code
String
if defined;null
otherwise.
-
hasPostalCode
public boolean hasPostalCode()
Returnstrue
if the address has postal code.- Returns:
true
if the address has postal codefalse
otherwise
-
setPostalCode
public void setPostalCode(java.lang.String aPostalCode)
Sets the contact postal code- Parameters:
aPostalCode
- contact postal code
-
getCountry
public java.lang.String getCountry()
Gets the contact country.- Returns:
- contact country
String
if defined;null
otherwise.
-
hasCountry
public boolean hasCountry()
Returnstrue
if the address has country.- Returns:
true
if the address has countryfalse
otherwise
-
setCountry
public void setCountry(java.lang.String aCountry)
Sets the contact country.- Parameters:
aCountry
- contact country
-
encode
public org.w3c.dom.Element encode(org.w3c.dom.Document aDocument) throws EPPEncodeException
Encode a DOM Element tree from the attributes of theEPPContactAddress
instance.- Specified by:
encode
in interfaceEPPCodecComponent
- Parameters:
aDocument
- DOM Document that is being built. Used as an Element factory.- Returns:
- Root DOM Element representing the
EPPContactAddress
instance. - Throws:
EPPEncodeException
- Unable to encodeEPPContactAddress
instance.
-
decode
public void decode(org.w3c.dom.Element aElement) throws EPPDecodeException
Decode theEPPContactAddress
attributes from the aElement DOM Element tree.- Specified by:
decode
in interfaceEPPCodecComponent
- Parameters:
aElement
- Root DOM Element to decodeEPPContactAddress
from.- Throws:
EPPDecodeException
- Unable to decode aElement.
-
equals
public boolean equals(java.lang.Object aObject)
implements a deepEPPContactAddress
compare.- Overrides:
equals
in classjava.lang.Object
- Parameters:
aObject
-EPPContactAddress
instance to compare with- Returns:
- boolean
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
CloneEPPContactAddress
.- Specified by:
clone
in interfaceEPPCodecComponent
- Overrides:
clone
in classjava.lang.Object
- Returns:
- clone of
EPPContactAddress
- Throws:
java.lang.CloneNotSupportedException
- standard Object.clone exception
-
toString
public java.lang.String toString()
Implementation oftoString
, which will result in an indented XMLString
representation of the concreteEPPCodecComponent
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Indented XML
String
if successful;ERROR
otherwise.
-
getNamespace
public java.lang.String getNamespace()
Returns the XML namespace associated with theEPPCodecComponent
.- Specified by:
getNamespace
in interfaceEPPCodecComponent
- Returns:
- XML namespace for the
EPPCodecComponent
.
-
-