ezvcard.property
Class Address

java.lang.Object
  extended by ezvcard.property.VCardProperty
      extended by ezvcard.property.Address
All Implemented Interfaces:
HasAltId, Comparable<VCardProperty>

public class Address
extends VCardProperty
implements HasAltId

A mailing address.

Adding an address

 VCard vcard = new VCard();
 Address adr = new Address();
 adr.setStreetAddress("123 Main St.");
 adr.setLocality("Austin");
 adr.setRegion("TX");
 adr.setPostalCode("12345");
 adr.setCountry("USA");
 adr.addType(AddressType.WORK);
 adr.addType(AddressType.DOM);
 
 //optionally, provide the exact text to print out on the mailing label
 adr.setLabel("123 Main St.\nAustin, Tx 12345\nUSA");
 
 vcard.addAddress(adr);
 

Getting the addresses

 VCard vcard = ...
 for (Address adr : vcard.getAddresses()){
   ...
 }
 

Property name: ADR

Supported versions: 2.1, 3.0, 4.0

Author:
Michael Angstadt

Field Summary
 
Fields inherited from class ezvcard.property.VCardProperty
group, parameters
 
Constructor Summary
Address()
           
 
Method Summary
protected  void _validate(List<Warning> warnings, VCardVersion version, VCard vcard)
          Checks the property for data consistency problems or deviations from the spec.
 void addPid(int localId, int clientPidMapRef)
           Adds a PID value.
 void addType(AddressType type)
          Adds a TYPE parameter.
 String getAltId()
          Gets the property's ALTID parameter.
 String getCountry()
          Gets the country.
 String getExtendedAddress()
          Gets the extended address.
 double[] getGeo()
          Gets the global positioning coordinates that are associated with this address.
 String getLabel()
          Gets the label of the address.
 String getLanguage()
          Gets the language that the property value is written in.
 String getLocality()
          Gets the locality (city)
 List<Integer[]> getPids()
           Gets all PID values.
 String getPoBox()
          Gets the P.O.
 String getPostalCode()
          Gets the postal code.
 Integer getPref()
           Gets the preference value.
 String getRegion()
          Gets the region.
 String getStreetAddress()
          Gets the street address
 String getTimezone()
          Gets the timezone that's associated with this address.
 Set<AddressType> getTypes()
          Gets all the TYPE parameters.
 void removePids()
           Removes all PID values.
 void removeType(AddressType type)
          Removes a TYPE parameter.
 void setAltId(String altId)
          Sets the property's ALTID parameter.
 void setCountry(String country)
          Sets the country.
 void setExtendedAddress(String extendedAddress)
          Sets the extended address.
 void setGeo(double latitude, double longitude)
          Sets the global positioning coordinates that are associated with this address.
 void setLabel(String label)
          Sets the label of the address.
 void setLanguage(String language)
          Sets the language that the property value is written in.
 void setLocality(String locality)
          Sets the locality (city).
 void setPoBox(String poBox)
          Sets the P.O.
 void setPostalCode(String postalCode)
          Sets the postal code.
 void setPref(Integer pref)
           Sets the preference value.
 void setRegion(String region)
          Sets the region.
 void setStreetAddress(String streetAddress)
          Sets the street address.
 void setTimezone(String timezone)
          Sets the timezone that's associated with this address.
 
Methods inherited from class ezvcard.property.VCardProperty
_supportedVersions, addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Address

public Address()
Method Detail

getPoBox

public String getPoBox()
Gets the P.O. (post office) box.

Returns:
the P.O. box or null if not set

setPoBox

public void setPoBox(String poBox)
Sets the P.O. (post office) box.

Parameters:
poBox - the P.O. box or null to remove

getExtendedAddress

public String getExtendedAddress()
Gets the extended address.

Returns:
the extended address (e.g. "Suite 200") or null if not set

setExtendedAddress

public void setExtendedAddress(String extendedAddress)
Sets the extended address.

Parameters:
extendedAddress - the extended address (e.g. "Suite 200") or null to remove

getStreetAddress

public String getStreetAddress()
Gets the street address

Returns:
the street address (e.g. "123 Main St")

setStreetAddress

public void setStreetAddress(String streetAddress)
Sets the street address.

Parameters:
streetAddress - the street address (e.g. "123 Main St") or null to remove

getLocality

public String getLocality()
Gets the locality (city)

Returns:
the locality (e.g. "Boston") or null if not set

setLocality

public void setLocality(String locality)
Sets the locality (city).

Parameters:
locality - the locality or null to remove

getRegion

public String getRegion()
Gets the region.

Returns:
the region (e.g. "Texas") or null if not set

setRegion

public void setRegion(String region)
Sets the region.

Parameters:
region - the region (e.g. "Texas") or null to remove

getPostalCode

public String getPostalCode()
Gets the postal code.

Returns:
the postal code (e.g. "90210") or null if not set

setPostalCode

public void setPostalCode(String postalCode)
Sets the postal code.

Parameters:
postalCode - the postal code (e.g. "90210") or null to remove

getCountry

public String getCountry()
Gets the country.

Returns:
the country (e.g. "USA") or null if not set

setCountry

public void setCountry(String country)
Sets the country.

Parameters:
country - the country (e.g. "USA") or null to remove

getTypes

public Set<AddressType> getTypes()
Gets all the TYPE parameters.

Returns:
the TYPE parameters or empty set if there are none

addType

public void addType(AddressType type)
Adds a TYPE parameter.

Parameters:
type - the TYPE parameter to add

removeType

public void removeType(AddressType type)
Removes a TYPE parameter.

Parameters:
type - the TYPE parameter to remove

getLanguage

public String getLanguage()
Description copied from class: VCardProperty
Gets the language that the property value is written in.

Returns:
the language or null if not set
See Also:
VCardParameters.getLanguage()

setLanguage

public void setLanguage(String language)
Description copied from class: VCardProperty
Sets the language that the property value is written in.

Parameters:
language - the language or null to remove
See Also:
VCardParameters.setLanguage(java.lang.String)

getLabel

public String getLabel()
Gets the label of the address.

Returns:
the label or null if it doesn't have one

setLabel

public void setLabel(String label)
Sets the label of the address.

Parameters:
label - the label or null to remove

getGeo

public double[] getGeo()
Gets the global positioning coordinates that are associated with this address.

Supported versions: 4.0

Returns:
the latitude (index 0) and longitude (index 1) or null if not set or null if the parameter value was in an incorrect format
See Also:
VCardParameters.getGeo()

setGeo

public void setGeo(double latitude,
                   double longitude)
Sets the global positioning coordinates that are associated with this address.

Supported versions: 4.0

Parameters:
latitude - the latitude
longitude - the longitude
See Also:
VCardParameters.setGeo(double, double)

getPids

public List<Integer[]> getPids()
Description copied from class: VCardProperty

Gets all PID values.

Supported versions: 4.0

Returns:
the PID values or empty set if there are none
See Also:
VCardParameters.getPids()

addPid

public void addPid(int localId,
                   int clientPidMapRef)
Description copied from class: VCardProperty

Adds a PID value.

Supported versions: 4.0

Parameters:
localId - the local ID
clientPidMapRef - the ID used to reference the property's globally unique identifier in the CLIENTPIDMAP property.
See Also:
VCardParameters.addPid(int, int)

removePids

public void removePids()
Description copied from class: VCardProperty

Removes all PID values.

Supported versions: 4.0

See Also:
VCardParameters.removePids()

getPref

public Integer getPref()
Description copied from class: VCardProperty

Gets the preference value. The lower the number, the more preferred this property instance is compared with other properties in the same vCard of the same type. If a property doesn't have a preference value, then it is considered the least preferred.

Supported versions: 4.0

Returns:
the preference value or null if it doesn't exist
See Also:
VCardParameters.getPref()

setPref

public void setPref(Integer pref)
Description copied from class: VCardProperty

Sets the preference value. The lower the number, the more preferred this property instance is compared with other properties in the same vCard of the same type. If a property doesn't have a preference value, then it is considered the least preferred.

Supported versions: 4.0

Parameters:
pref - the preference value or null to remove
See Also:
VCardParameters.setPref(java.lang.Integer)

getAltId

public String getAltId()
Description copied from interface: HasAltId
Gets the property's ALTID parameter.

Supported versions: 4.0

Specified by:
getAltId in interface HasAltId
Returns:
the ALTID or null if it doesn't exist
See Also:
VCardParameters.getAltId()

setAltId

public void setAltId(String altId)
Description copied from interface: HasAltId
Sets the property's ALTID parameter.

Supported versions: 4.0

Specified by:
setAltId in interface HasAltId
Parameters:
altId - the ALTID or null to remove
See Also:
VCardParameters.setAltId(java.lang.String)

getTimezone

public String getTimezone()
Gets the timezone that's associated with this address.

Supported versions: 4.0

Returns:
the timezone (e.g. "America/New_York") or null if it doesn't exist

setTimezone

public void setTimezone(String timezone)
Sets the timezone that's associated with this address.

Supported versions: 4.0

Parameters:
timezone - the timezone (e.g. "America/New_York") or null to remove

_validate

protected void _validate(List<Warning> warnings,
                         VCardVersion version,
                         VCard vcard)
Description copied from class: VCardProperty
Checks the property for data consistency problems or deviations from the spec. Meant to be overridden by child classes that wish to provide validation logic.

Overrides:
_validate in class VCardProperty
Parameters:
warnings - the list to add the warnings to
version - the version to check the property against
vcard - the vCard this property belongs to


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.