public class Deathdate extends DateOrTimeProperty
Defines the person's time of death.
Code sample (creating)
VCard vcard = new VCard(); //date Calendar c = Calendar.getInstance(); c.clear(); c.set(Calendar.YEAR, 1954); c.set(Calendar.MONTH, Calendar.JUNE); c.set(Calendar.DAY_OF_MONTH, 7); Deathdate deathdate = new Deathdate(c.getTime()); vcard.setDeathdate(deathdate); //partial date (e.g. just the month and date) deathdate = new Deathdate(PartialDate.date(null, 6, 7)); //June 7 vcard.setDeathdate(deathdate); //plain text value deathdate = new Deathdate("In the 1950s"); vcard.setDeathdate(deathdate);
Code sample (retrieving)
VCard vcard = ... Deathdate deathdate = vcard.getDeathdate(); Date date = deathdate.getDate(); if (date != null){ //property value is a date } PartialDate partialDate = deathdate.getPartialDate(); if (partialDate != null){ //property value is a partial date int year = partialDate.getYear(); int month = partialDate.getMonth(); } String text = deathdate.getText(); if (text != null){ //property value is plain text }
Property name: DEATHDATE
Supported versions: 4.0
group, parameters
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
_validate, getAltId, getCalscale, getDate, getPartialDate, getText, hasTime, setAltId, setCalscale, setDate, setPartialDate, setText
addParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, removeParameter, setGroup, setParameter, setParameters, validate
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)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)
This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.