@SupportedVersions(value=V4_0) public class Deathdate extends DateOrTimeProperty
Defines the person's time of death.
Code sample (creating)
VCard vcard = new VCard();
//date
LocalDate date = LocalDate.of(1954, 6, 7);
Deathdate deathdate = new Deathdate(date);
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();
Temporal 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(Deathdate original)
Copy constructor.
|
Deathdate(PartialDate partialDate)
Creates a deathdate property.
|
Deathdate(String text)
Creates a deathdate property.
|
Deathdate(Temporal date)
Creates a deathdate property.
|
| Modifier and Type | Method and Description |
|---|---|
Deathdate |
copy()
Creates a copy of this property object.
|
_validate, equals, getAltId, getCalscale, getDate, getLanguage, getPartialDate, getText, hashCode, setAltId, setCalscale, setDate, setLanguage, setPartialDate, setText, toStringValuesaddParameter, compareTo, getGroup, getParameter, getParameters, getParameters, getSupportedVersions, isSupportedBy, removeParameter, setGroup, setParameter, setParameters, toString, validatepublic Deathdate(Temporal date)
date - the deathdatepublic Deathdate(PartialDate partialDate)
partialDate - the deathdate (vCard 4.0 only)public Deathdate(String text)
text - the text value (vCard 4.0 only)public Deathdate copy()
VCardPropertyCreates a copy of this property object.
The default implementation of this method uses reflection to look for a copy constructor. Child classes SHOULD override this method to avoid the performance overhead involved in using reflection.
The child class's copy constructor, if present, MUST invoke the
VCardProperty.VCardProperty(VCardProperty) super constructor to ensure that
the group name and parameters are also copied.
This method MUST be overridden by the child class if the child class does
not have a copy constructor. Otherwise, an
UnsupportedOperationException will be thrown when an attempt is
made to copy the property (such as in the VCard
class's copy constructor).
copy in class VCardPropertyCopyright © 2012–2023 Michael Angstadt. All rights reserved.