ezvcard.types
Class BirthdayType
java.lang.Object
ezvcard.types.VCardType
ezvcard.types.DateOrTimeType
ezvcard.types.BirthdayType
- All Implemented Interfaces:
- Comparable<VCardType>
public class BirthdayType
- extends DateOrTimeType
Defines the person's birthday.
Setting the birthday
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);
BirthdayType bday = new BirthdayType();
bday.setDate(c.getTime(), false);
vcard.setBirthday(bday);
//reduced accuracy date (vCard 4.0 only, see RFC 6350 p.12-14 for examples)
bday = new BirthdayType();
bday.setReducedAccuracyDate("--0321"); //March 21
vcard.setBirthday(bday);
//plain text value (vCard 4.0 only)
bday = new BirthdayType();
bday.setText("a long time ago");
vcard.setBirthday(bday);
Getting the birthday
VCard vcard = ...
BirthdayType bday = vcard.getBirthday();
if (bday != null){
if (bday.getDate() != null){
System.out.println(bday.getDate());
} else if (bday.getReducedAccuracyDate() != null){
System.out.println(bday.getReducedAccuracyDate());
} else if (bday.getText() != null){
System.out.println(bday.getText());
}
}
vCard property name: BDAY
vCard versions: 2.1, 3.0, 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, getSupportedVersions, 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
BirthdayType
public BirthdayType()
BirthdayType
public BirthdayType(Date date)
- Parameters:
date
- the birthday
Copyright © 2012-2013. All Rights Reserved.