ezvcard.types
Class AnniversaryType
java.lang.Object
ezvcard.types.VCardType
ezvcard.types.DateOrTimeType
ezvcard.types.AnniversaryType
- All Implemented Interfaces:
- Comparable<VCardType>
public class AnniversaryType
- extends DateOrTimeType
Defines the person's anniversary.
Setting the anniversary
VCard vcard = new VCard();
//complete date
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, 1986);
c.set(Calendar.MONTH, Calendar.MARCH);
c.set(Calendar.DAY_OF_MONTH, 21);
AnniversaryType anniversary = new AnniversaryType();
anniversary.setDate(c.getTime(), false);
vcard.setAnniversary(anniversary);
//reduced accuracy date (see RFC 6350 p.12-14 for examples)
anniversary = new AnniversaryType();
anniversary.setReducedAccuracyDate("--0321"); //March 21
vcard.setAnniversary(anniversary);
//plain text value
anniversary = new AnniversaryType();
anniversary.setText("more than 20 years ago");
vcard.setAnniversary(anniversary);
Getting the anniversary
VCard vcard = ...
AnniversaryType anniversary = vcard.getAnniversary();
if (anniversary != null){
if (anniversary.getDate() != null){
System.out.println(anniversary.getDate());
} else if (anniversary.getReducedAccuracyDate() != null){
System.out.println(anniversary.getReducedAccuracyDate());
} else if (anniversary.getText() != null){
System.out.println(anniversary.getText());
}
}
vCard property name: ANNIVERSARY
vCard versions: 4.0
- Author:
- Michael Angstadt
Methods inherited from class ezvcard.types.DateOrTimeType |
doMarshalSubTypes, doMarshalText, doMarshalXml, doUnmarshalHtml, doUnmarshalText, doUnmarshalXml, getAltId, getCalscale, getDate, getReducedAccuracyDate, getText, setAltId, setCalsclae, setDate, setReducedAccuracyDate, setText |
Methods inherited from class ezvcard.types.VCardType |
compareTo, getGroup, getQName, getSubTypes, getTypeName, marshalSubTypes, marshalText, marshalXml, setGroup, unmarshalHtml, unmarshalText, unmarshalXml |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME
public static final String NAME
- See Also:
- Constant Field Values
AnniversaryType
public AnniversaryType()
AnniversaryType
public AnniversaryType(Date date)
- Parameters:
date
- the anniversary date
getSupportedVersions
public VCardVersion[] getSupportedVersions()
- Description copied from class:
VCardType
- Gets the vCard versions that support this type.
- Overrides:
getSupportedVersions
in class VCardType
- Returns:
- the vCard versions that support this type.
Copyright © 2012-2013. All Rights Reserved.