@SupportedVersions(value={V2_1,V3_0}) public class Agent extends VCardProperty
Defines information about the person's agent.
Code sample (creating)
VCard vcard = new VCard();
//URL
Agent agent = new Agent("http://www.linkedin.com/BobSmith");
vcard.setAgent(agent);
//vCard
VCard agentVCard = new VCard();
agentVCard.setFormattedName("Bob Smith");
agentVCard.addTelephoneNumber("(555) 123-4566");
agentVCard.addUrl("http://www.linkedin.com/BobSmith");
agent = new Agent(agentVCard);
vcard.setAgent(agent);
Code sample (retrieving)
VCard vcard = ...
Agent agent = vcard.getAgent();
String url = agent.getUrl();
if (url != null) {
//property value is a URL
}
VCard agentVCard = agent.getVCard();
if (agentVCard != null) {
//property value is a vCard
}
Property name: AGENT
Supported versions: 2.1, 3.0
group, parameters| Constructor and Description |
|---|
Agent()
Creates an empty agent property.
|
Agent(Agent original)
Copy constructor.
|
Agent(String url)
Creates an agent property.
|
Agent(VCard vcard)
Creates an agent 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.
|
Agent |
copy()
Creates a copy of this property object.
|
boolean |
equals(Object obj) |
String |
getUrl()
Gets the URL to the agent's information.
|
VCard |
getVCard()
Gets an embedded vCard with the agent's information.
|
int |
hashCode() |
void |
setUrl(String url)
Sets the URL to the agent's information.
|
void |
setVCard(VCard vcard)
Sets an embedded vCard with the agent's information.
|
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 Agent()
public Agent(String url)
url - a URL pointing to the agent's informationpublic Agent(VCard vcard)
vcard - a vCard containing the agent's informationpublic String getUrl()
public void setUrl(String url)
url - the URLpublic VCard getVCard()
public void setVCard(VCard vcard)
vcard - the vCardprotected 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 Agent 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.