@SupportedVersions(value=V4_0) public class ClientPidMap extends VCardProperty
Maps a globally-unique URI to a PID parameter value. The PID parameter can be
set on any property where multiple instances are allowed (such as
Email
or Address
, but not StructuredName
because only
1 instance of it is allowed). It allows an individual property instance to be
uniquely identifiable.
This property, along with the PID parameter, is used during the synchronization (merging) process of two versions of the same vCard. For example, if the user has a copy of her vCard on her desktop computer and her smart phone, and she makes different modifications to each copy, then the two copies could be synchronized in order to merge all the changes into a single, new vCard.
Code sample
VCard vcard = new VCard(); Address adr = new Address(); adr.addPid(1, 1); vcard.addAddress(adr); Email email = vcard.addEmail("johndoe@hotmail.com"); emai.addPid(1, 1); email = vcard.addEmail("jdoe@company.com"); email.addPid(2, 2); //specify the URI to use ClientPidMap clientpidmap = new ClientPidMap(1, "urn:uuid:03a0e51f-d1aa-4385-8a53-e29025acd8af"); vcard.addClientPidMap(clientpidmap); //or, generate a random URI clientpidmap = ClientPidMap.random(2); vcard.addClientPidMap(clientpidmap);
Property name: CLIENTPIDMAP
Supported versions: 4.0
group, parameters
Constructor and Description |
---|
ClientPidMap(ClientPidMap original)
Copy constructor.
|
ClientPidMap(Integer pid,
String uri)
Creates a client PID map 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.
|
ClientPidMap |
copy()
Creates a copy of this property object.
|
boolean |
equals(Object obj) |
Integer |
getPid()
Gets the value that is used to link the URI in this property to the
property that the URI belongs to.
|
String |
getUri()
Gets the URI.
|
int |
hashCode() |
static ClientPidMap |
random(Integer pid)
Generates a CLIENTPIDMAP type that contains a random UID URI.
|
void |
setPid(Integer pid)
Gets the value that is used to link the URI in this property to the
property that the URI belongs to.
|
void |
setUri(String uri)
Sets the URI.
|
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 ClientPidMap(Integer pid, String uri)
pid
- the PIDuri
- the globally unique URIpublic ClientPidMap(ClientPidMap original)
original
- the property to make a copy ofpublic static ClientPidMap random(Integer pid)
pid
- the PIDpublic Integer getPid()
public void setPid(Integer pid)
pid
- the PIDprotected 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 ClientPidMap 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.