|
||||||||||
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.Anniversary
public class Anniversary
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); Anniversary anniversary = new Anniversary(); anniversary.setDate(c.getTime(), false); vcard.setAnniversary(anniversary); //reduced accuracy date (see RFC 6350 p.12-14 for examples) anniversary = new Anniversary(); anniversary.setPartialDate(PartialDate.date(null, 3, 21)); //March 21 vcard.setAnniversary(anniversary); //plain text value anniversary = new Anniversary(); anniversary.setText("more than 20 years ago"); vcard.setAnniversary(anniversary);
Getting the anniversary
VCard vcard = ... Anniversary anniversary = vcard.getAnniversary(); if (anniversary != null){ if (anniversary.getDate() != null){ System.out.println(anniversary.getDate()); } else if (anniversary.getPartialDate() != null){ System.out.println("Year: " + anniversary.getPartialDate().getYear()); System.out.println("Month: " + anniversary.getPartialDate().getMonth()); //... } else if (anniversary.getText() != null){ System.out.println(anniversary.getText()); } }
Property name: ANNIVERSARY
Supported versions: 4.0
Field Summary |
---|
Fields inherited from class ezvcard.property.VCardProperty |
---|
group, parameters |
Constructor Summary | |
---|---|
Anniversary(Date date)
Creates an anniversary property. |
|
Anniversary(Date date,
boolean hasTime)
Creates an anniversary property. |
|
Anniversary(PartialDate partialDate)
Creates an anniversary property. |
|
Anniversary(String text)
Creates an anniversary property. |
Method Summary | |
---|---|
Set<VCardVersion> |
_supportedVersions()
Gets the vCard versions that support this property. |
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 |
---|
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 Anniversary(Date date)
date
- the anniversary datepublic Anniversary(Date date, boolean hasTime)
date
- the anniversary datehasTime
- true to include the date's time component, false if it's
strictly a datepublic Anniversary(PartialDate partialDate)
partialDate
- the partial anniversary date (vCard 4.0 only)public Anniversary(String text)
text
- the text value (vCard 4.0 only)Method Detail |
---|
public Set<VCardVersion> _supportedVersions()
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.
_supportedVersions
in class VCardProperty
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |