@SupportedVersions(value=V4_0) public class Related extends VCardProperty implements HasAltId
Defines someone that the person is related to.
Code sample
VCard vcard = new VCard();
//static factory methods
Related related = Related.email("bob.smith@example.com");
related.getTypes().add(RelatedType.CO_WORKER);
related.getTypes().add(RelatedType.FRIEND);
vcard.addRelated(related);
//free-form text
related = new Related();
related.setText("Edna Smith");
related.getTypes().add(RelatedType.SPOUSE);
vcard.addRelated(related);
//reference another vCard by putting its UID property here
related = new Related("urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af");
related.getTypes().add(RelatedType.SIBLING);
vcard.addRelated(related);
Property name: RELATED
Supported versions: 4.0
group, parameters| Constructor and Description |
|---|
Related()
Creates a related property
|
Related(Related original)
Copy constructor.
|
Related(String uri)
Creates a related 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.
|
Related |
copy()
Creates a copy of this property object.
|
static Related |
email(String email)
Creates a related property whose value is an email address.
|
boolean |
equals(Object obj) |
String |
getAltId()
Gets the property's ALTID 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 |
getText()
Gets the text value.
|
List<RelatedType> |
getTypes()
Gets the list that stores this property's relationship types (TYPE
parameters).
|
String |
getUri()
Gets the URI value.
|
int |
hashCode() |
static Related |
im(String protocol,
String handle)
Creates a related property whose value is an instant messenger handle.
|
void |
setAltId(String altId)
Sets the property's ALTID parameter.
|
void |
setPref(Integer pref)
Sets this property's preference value.
|
void |
setText(String text)
Sets the value to free-form text instead of a URI.
|
void |
setUri(String uri)
Sets the URI.
|
static Related |
telephone(TelUri telUri)
Creates a related property whose value is a telephone number.
|
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, validatepublic Related()
public Related(String uri)
uri - the URI representing the personpublic static Related email(String email)
email - the email addresspublic static Related im(String protocol, String handle)
protocol - the instant messenger protocol (e.g. "aim")handle - the instant messenger handle (e.g. "johndoe")public static Related telephone(TelUri telUri)
telUri - the telephone numberpublic String getUri()
public String getText()
public void setText(String text)
text - the textpublic List<RelatedType> getTypes()
public List<Pid> getPids()
VCardPropertyGets 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()
VCardPropertyGets 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)
VCardPropertySets 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 HasAltIdVCardParameters.getAltId()public void setAltId(String altId)
HasAltId
Supported versions: 4.0
setAltId in interface HasAltIdaltId - the ALTID or null to removeVCardParameters.setAltId(java.lang.String)protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard)
VCardProperty_validate in class VCardPropertywarnings - 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 VCardPropertypublic Related copy()
VCardPropertyCreates 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 VCardPropertypublic int hashCode()
hashCode in class VCardPropertypublic boolean equals(Object obj)
equals in class VCardPropertyCopyright © 2012–2023 Michael Angstadt. All rights reserved.