|
||||||||||
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.Deathdate
public class Deathdate
Defines the person's time of death.
Setting the time of death
VCard vcard = new VCard(); //complete date Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, 1954); c.set(Calendar.MONTH, Calendar.JUNE); c.set(Calendar.DAY_OF_MONTH, 7); Deathdate deathdate = new Deathdate(); deathdate.setDate(c.getTime(), false); vcard.setDeathdate(deathdate); //reduced accuracy date deathdate = new Deathdate(); deathdate.setPartalDate(PartialDate.date(null, 6, 7)); //June 7 vcard.setDeathdate(deathdate); //plain text value deathdate = new Deathdate(); deathdate.setText("circa 1954"); vcard.setDeathdate(deathdate);
Getting the time of death
VCard vcard = ... Deathdate deathdate = vcard.getDeathdate(); if (deathdate != null){ if (deathdate.getDate() != null){ System.out.println(deathdate.getDate()); } else if (deathdate.getPartalDate() != null){ System.out.println("Year: " + deathdate.getPartialDate().getYear()); System.out.println("Month: " + deathdate.getPartialDate().getMonth()); //... } else if (deathdate.getText() != null){ System.out.println(deathdate.getText()); } }
Property name: DEATHDATE
Supported versions: 4.0
Field Summary |
---|
Fields inherited from class ezvcard.property.VCardProperty |
---|
group, parameters |
Constructor Summary | |
---|---|
Deathdate(Date date)
Creates a deathdate property. |
|
Deathdate(Date date,
boolean hasTime)
Creates a deathdate property. |
|
Deathdate(PartialDate partialDate)
Creates a deathdate property. |
|
Deathdate(String text)
Creates a deathdate property. |
Method Summary | |
---|---|
Set<VCardVersion> |
_supportedVersions()
Gets the vCard versions that support this property. |
String |
getLanguage()
Gets the language that the property value is written in. |
void |
setLanguage(String language)
Sets the language that the property value is written in. |
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 Deathdate(Date date)
date
- the deathdatepublic Deathdate(Date date, boolean hasTime)
date
- the deathdatehasTime
- true to include the date's time component, false if it's
strictly a datepublic Deathdate(PartialDate partialDate)
partialDate
- the deathdate (vCard 4.0 only)public Deathdate(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
public String getLanguage()
VCardProperty
VCardParameters.getLanguage()
public void setLanguage(String language)
VCardProperty
language
- the language or null to removeVCardParameters.setLanguage(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |