ezvcard.property
Class Impp

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

public class Impp
extends VCardProperty
implements HasAltId

An instant message handle. The handle is represented as a URI in the format " <IM-PROTOCOL>:<IM-HANDLE>". For example, someone with a Yahoo! Messenger handle of "johndoe@yahoo.com" would have an IMPP vCard property value of "ymsgr:johndoe@yahoo.com".

Code sample

 VCard vcard = new VCard();
 
 //URI
 Impp impp = new Impp("aim:johndoe@aol.com");
 vcard.addImpp(impp);
 
 //static factory methods
 impp = Impp.msn("janedoe@msn.com");
 vcard.addImpp(impp);
 

Property name: IMPP

Supported versions: 3.0, 4.0

Author:
Michael Angstadt

Field Summary
 
Fields inherited from class ezvcard.property.VCardProperty
group, parameters
 
Constructor Summary
Impp(String uri)
          Creates an IMPP property.
Impp(String protocol, String handle)
          Creates an IMPP property.
Impp(URI uri)
          Creates an IMPP property.
 
Method Summary
 Set<VCardVersion> _supportedVersions()
           Gets the vCard versions that support this property.
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(ImppType type)
          Adds a TYPE parameter.
static Impp aim(String handle)
          Creates an IMPP property that contains a AOL Instant Messenger handle.
 String getAltId()
          Gets the property's ALTID parameter.
 String getHandle()
          Gets the IM handle.
 String getMediaType()
          Gets the MEDIATYPE parameter.
 List<Integer[]> getPids()
           Gets all PID values.
 Integer getPref()
           Gets the preference value.
 String getProtocol()
          Gets the IM protocol.
 Set<ImppType> getTypes()
          Gets all the TYPE parameters.
 URI getUri()
          Gets the IM URI.
static Impp icq(String handle)
          Creates an IMPP property that contains an ICQ handle.
static Impp irc(String handle)
          Creates an IMPP property that contains an IRC handle.
 boolean isAim()
          Determines if this IMPP property contains an AOL Instant Messenger handle.
 boolean isIcq()
          Determines if this IMPP property contains an ICQ handle.
 boolean isIrc()
          Determines if this IMPP property contains an IRC handle.
 boolean isMsn()
          Determines if this IMPP property contains an MSN handle.
 boolean isSip()
          Determines if this IMPP property contains a Session Initiation Protocol handle.
 boolean isSkype()
          Determines if this IMPP property contains a Skype handle.
 boolean isXmpp()
          Determines if this IMPP property contains an Extensible Messaging and Presence Protocol handle.
 boolean isYahoo()
          Determines if this IMPP property contains a Yahoo! Messenger handle.
static Impp msn(String handle)
          Creates an IMPP property that contains an MSN IMPP property.
 void removePids()
           Removes all PID values.
 void removeType(ImppType type)
          Removes a TYPE parameter.
 void setAltId(String altId)
          Sets the property's ALTID parameter.
 void setMediaType(String mediaType)
          Sets the MEDIATYPE parameter.
 void setPref(Integer pref)
           Sets the preference value.
 void setUri(String uri)
          Sets the IM URI.
 void setUri(String protocol, String handle)
          Sets the IM URI.
 void setUri(URI uri)
          Sets the IM URI.
static Impp sip(String handle)
          Creates an IMPP property that contains a Session Initiation Protocol handle.
static Impp skype(String handle)
          Creates an IMPP property that contains a Skype handle.
static Impp xmpp(String handle)
          Creates an IMPP property that contains an Extensible Messaging and Presence Protocol handle.
static Impp yahoo(String handle)
          Creates an IMPP property that contains a Yahoo! Messenger handle.
 
Methods inherited from class ezvcard.property.VCardProperty
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

Impp

public Impp(String uri)
Creates an IMPP property. Note that this class has static factory methods for creating IMPP properties of common IM protocols.

Parameters:
uri - the IM URI (e.g. "aim:johndoe@aol.com")
Throws:
IllegalArgumentException - if the URI is not a valid URI

Impp

public Impp(URI uri)
Creates an IMPP property. Note that this class has static factory methods for creating IMPP properties of common IM protocols.

Parameters:
uri - the IM URI (e.g. "aim:johndoe@aol.com")

Impp

public Impp(String protocol,
            String handle)
Creates an IMPP property. Note that this class has static factory methods for creating IMPP properties of common IM protocols.

Parameters:
protocol - the IM protocol (e.g. "aim")
handle - the IM handle (e.g. "johndoe@aol.com")
Method Detail

_supportedVersions

public Set<VCardVersion> _supportedVersions()
Description copied from class: VCardProperty

Gets the vCard versions that support this property.

This method should be overridden by child classes if the property does not support all vCard versions. The default implementation of this method returns all vCard versions.

Overrides:
_supportedVersions in class VCardProperty
Returns:
the vCard versions that support this property.

aim

public static Impp aim(String handle)
Creates an IMPP property that contains a AOL Instant Messenger handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isAim

public boolean isAim()
Determines if this IMPP property contains an AOL Instant Messenger handle.

Returns:
true if it contains an AOL Instant Messenger handle, false if not

yahoo

public static Impp yahoo(String handle)
Creates an IMPP property that contains a Yahoo! Messenger handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isYahoo

public boolean isYahoo()
Determines if this IMPP property contains a Yahoo! Messenger handle.

Returns:
true if it contains a Yahoo! Messenger handle, false if not

msn

public static Impp msn(String handle)
Creates an IMPP property that contains an MSN IMPP property.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isMsn

public boolean isMsn()
Determines if this IMPP property contains an MSN handle.

Returns:
true if it contains an MSN handle, false if not

icq

public static Impp icq(String handle)
Creates an IMPP property that contains an ICQ handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isIcq

public boolean isIcq()
Determines if this IMPP property contains an ICQ handle.

Returns:
true if it contains an ICQ handle, false if not

irc

public static Impp irc(String handle)
Creates an IMPP property that contains an IRC handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isIrc

public boolean isIrc()
Determines if this IMPP property contains an IRC handle.

Returns:
true if it contains an IRC handle, false if not

sip

public static Impp sip(String handle)
Creates an IMPP property that contains a Session Initiation Protocol handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isSip

public boolean isSip()
Determines if this IMPP property contains a Session Initiation Protocol handle.

Returns:
true if it contains a SIP handle, false if not

skype

public static Impp skype(String handle)
Creates an IMPP property that contains a Skype handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isSkype

public boolean isSkype()
Determines if this IMPP property contains a Skype handle.

Returns:
true if it contains a Skype handle, false if not

xmpp

public static Impp xmpp(String handle)
Creates an IMPP property that contains an Extensible Messaging and Presence Protocol handle.

Parameters:
handle - the IM handle
Returns:
the IMPP property instance

isXmpp

public boolean isXmpp()
Determines if this IMPP property contains an Extensible Messaging and Presence Protocol handle.

Returns:
true if it contains an XMPP handle, false if not

getUri

public URI getUri()
Gets the IM URI.

Returns:
the IM URI

setUri

public void setUri(String uri)
Sets the IM URI.

Parameters:
uri - the IM URI (e.g. "aim:theuser@aol.com")
Throws:
IllegalArgumentException - if the URI is not a valid URI

setUri

public void setUri(URI uri)
Sets the IM URI.

Parameters:
uri - the IM URI (e.g. "aim:theuser@aol.com")

setUri

public void setUri(String protocol,
                   String handle)
Sets the IM URI.

Parameters:
protocol - the IM protocol (e.g. "aim")
handle - the IM handle (e.g. "theuser@aol.com")

getProtocol

public String getProtocol()
Gets the IM protocol. Use setUri(String, String) to set the protocol.

Returns:
the IM protocol (e.g. "aim") or null if not set

getHandle

public String getHandle()
Gets the IM handle. Use setUri(String, String) to set the handle.

Returns:
the IM handle (e.g. "johndoe@aol.com") or null if not set

getTypes

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

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

addType

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

Parameters:
type - the TYPE parameter to add

removeType

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

Parameters:
type - the TYPE parameter to remove

getMediaType

public String getMediaType()
Gets the MEDIATYPE parameter.

Supported versions: 4.0

Returns:
the media type or null if not set

setMediaType

public void setMediaType(String mediaType)
Sets the MEDIATYPE parameter.

Supported versions: 4.0

Parameters:
mediaType - the media type or null to remove

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)

_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.