public class Geo extends VCardProperty implements HasAltId
Defines a set of latitude/longitude coordinates. There is no rule as to what
these coordinates represent, but their meaning could vary depending on the
value of the vCard's Kind
property:
Kind value |
Geo meaning |
---|---|
"individual" | The location of the person's home or workplace. |
"group" | The location of the group's meeting place. |
"org" | The coordinates of the organization's headquarters. |
"location" | The coordinates of the location itself. |
Code sample
VCard vcard = new VCard(); Geo geo = new Geo(40.7127, -74.0059); vcard.setGeo(geo);
Property name: GEO
Supported versions: 2.1, 3.0, 4.0
group, parameters
Constructor and Description |
---|
Geo(Double latitude,
Double longitude)
Creates a geo property.
|
Geo(Geo original)
Copy constructor.
|
Geo(GeoUri uri)
Creates a geo property.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_validate(List<ValidationWarning> warnings,
VCardVersion version,
VCard vcard)
Checks the property for data consistency problems or deviations from the
spec.
|
Geo |
copy()
Creates a copy of this property object.
|
boolean |
equals(Object obj) |
String |
getAltId()
Gets the property's ALTID parameter.
|
GeoUri |
getGeoUri()
Gets the raw object used for storing the GEO information.
|
Double |
getLatitude()
Gets the latitude.
|
Double |
getLongitude()
Gets the longitude.
|
String |
getMediaType()
Gets the MEDIATYPE parameter.
|
List<Pid> |
getPids()
Gets the list that stores this property's PID (property ID) parameter
values.
|
Integer |
getPref()
Gets this property's preference value.
|
String |
getType()
Gets the TYPE parameter.
|
int |
hashCode() |
void |
setAltId(String altId)
Sets the property's ALTID parameter.
|
void |
setGeoUri(GeoUri uri)
Sets the raw object used for storing the GEO information.
|
void |
setLatitude(Double latitude)
Sets the latitude.
|
void |
setLongitude(Double longitude)
Sets the longitude.
|
void |
setMediaType(String mediaType)
Sets the MEDIATYPE parameter.
|
void |
setPref(Integer pref)
Sets this property's preference value.
|
void |
setType(String type)
Sets the TYPE parameter.
|
protected Map<String,Object> |
toStringValues()
Gets string representations of the class's fields for the
VCardProperty.toString() method. |
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, isSupportedBy, removeParameter, setGroup, setParameter, setParameters, toString, validate
public Geo(Double latitude, Double longitude)
latitude
- the latitudelongitude
- the longitudepublic Double getLatitude()
public void setLatitude(Double latitude)
latitude
- the latitudepublic Double getLongitude()
public void setLongitude(Double longitude)
longitude
- the longitudepublic GeoUri getGeoUri()
public void setGeoUri(GeoUri uri)
uri
- the geo URI objectpublic String getType()
Supported versions: 4.0
public void setType(String type)
Supported versions: 4.0
type
- the TYPE value (this should be either "work" or "home") or
null to removepublic String getMediaType()
Supported versions: 4.0
public void setMediaType(String mediaType)
Supported versions: 4.0
mediaType
- the media type or null to removepublic List<Pid> getPids()
VCardProperty
Gets the list that stores this property's PID (property ID) parameter values.
PIDs can exist on any property where multiple instances are allowed (such
as Email
or Address
, but not StructuredName
because only 1 instance of this property is allowed per vCard).
When used in conjunction with the ClientPidMap
property, it
allows an individual property instance to be uniquely identifiable. This
feature is made use of when two different versions of the same vCard have
to be merged together (called "synchronizing").
Supported versions: 4.0
public Integer getPref()
VCardProperty
Gets this property's preference value. The lower this number is, the more "preferred" the property instance is compared with other properties of the same type. If a property doesn't have a preference value, then it is considered the least preferred.
In the vCard below, the Address
on the second row is the most
preferred because it has the lowest PREF value.
ADR;TYPE=work;PREF=2:;;1600 Amphitheatre Parkway;Mountain View;CA;94043 ADR;TYPE=work;PREF=1:;;One Microsoft Way;Redmond;WA;98052 ADR;TYPE=home:;;123 Maple St;Hometown;KS;12345
Supported versions: 4.0
public void setPref(Integer pref)
VCardProperty
Sets this property's preference value. The lower this number is, the more "preferred" the property instance is compared with other properties of the same type. If a property doesn't have a preference value, then it is considered the least preferred.
In the vCard below, the Address
on the second row is the most
preferred because it has the lowest PREF value.
ADR;TYPE=work;PREF=2:;;1600 Amphitheatre Parkway;Mountain View;CA;94043 ADR;TYPE=work;PREF=1:;;One Microsoft Way;Redmond;WA;98052 ADR;TYPE=home:;;123 Maple St;Hometown;KS;12345
Supported versions: 4.0
pref
- the preference value or null to removepublic String getAltId()
HasAltId
Supported versions: 4.0
getAltId
in interface HasAltId
VCardParameters.getAltId()
public void setAltId(String altId)
HasAltId
Supported versions: 4.0
setAltId
in interface HasAltId
altId
- the ALTID or null to removeVCardParameters.setAltId(java.lang.String)
protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard)
VCardProperty
_validate
in class VCardProperty
warnings
- the list to add the warnings toversion
- the version to check the property againstvcard
- the vCard this property belongs toprotected Map<String,Object> toStringValues()
VCardProperty
Gets string representations of the class's fields for the
VCardProperty.toString()
method.
Meant to be overridden by child classes. The default implementation returns an empty map.
toStringValues
in class VCardProperty
public Geo copy()
VCardProperty
Creates a copy of this property object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
VCardProperty.VCardProperty(VCardProperty)
super constructor to ensure that
the group name and parameters are also copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException
will be thrown when an attempt is
made to copy the property (such as in the VCard
class's copy constructor
).
copy
in class VCardProperty
public int hashCode()
hashCode
in class VCardProperty
public boolean equals(Object obj)
equals
in class VCardProperty
Copyright © 2012–2023 Michael Angstadt. All rights reserved.