|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectezvcard.property.VCardProperty
ezvcard.property.DateOrTimeProperty
ezvcard.property.Birthday
public class Birthday
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); Birthday bday = new Birthday(); 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 Birthday(); bday.setPartialDate(PartialDate.date(null, 3, 21)); //March 21 vcard.setBirthday(bday); //plain text value (vCard 4.0 only) bday = new Birthday(); bday.setText("a long time ago"); vcard.setBirthday(bday);
Getting the birthday
VCard vcard = ... Birthday bday = vcard.getBirthday(); if (bday != null){ if (bday.getDate() != null){ System.out.println(bday.getDate()); } else if (bday.getPartialDate() != null){ System.out.println("Year: " + bday.getPartialDate().getYear()); System.out.println("Month: " + bday.getPartialDate().getMonth()); //... } else if (bday.getText() != null){ System.out.println(bday.getText()); } }
Property name: BDAY
Supported versions: 2.1, 3.0, 4.0
Field Summary |
---|
Fields inherited from class ezvcard.property.VCardProperty |
---|
group, parameters |
Constructor Summary | |
---|---|
Birthday(Date date)
Creates a birthday property. |
|
Birthday(Date date,
boolean hasTime)
Creates a birthday property. |
|
Birthday(PartialDate partialDate)
Creates a birthday property. |
|
Birthday(String text)
Creates a birthday property. |
Method Summary |
---|
Methods inherited from class ezvcard.property.DateOrTimeProperty |
---|
_validate, getAltId, getCalscale, getDate, getPartialDate, getText, hasTime, setAltId, setCalscale, setDate, setPartialDate, setText |
Methods inherited from class ezvcard.property.VCardProperty |
---|
_supportedVersions, 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 |
---|
public Birthday(Date date)
date
- the birthdaypublic Birthday(Date date, boolean hasTime)
date
- the birthdayhasTime
- true to include the date's time component, false if it's
strictly a datepublic Birthday(PartialDate partialDate)
partialDate
- the birthday (vCard 4.0 only)public Birthday(String text)
text
- the text value (vCard 4.0 only)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |