ezvcard.property
Class Deathdate

java.lang.Object
  extended by ezvcard.property.VCardProperty
      extended by ezvcard.property.DateOrTimeProperty
          extended by ezvcard.property.Deathdate
All Implemented Interfaces:
HasAltId, Comparable<VCardProperty>

public class Deathdate
extends DateOrTimeProperty

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

Author:
Michael Angstadt
See Also:
RFC 6474

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

Deathdate

public Deathdate(Date date)
Creates a deathdate property.

Parameters:
date - the deathdate

Deathdate

public Deathdate(Date date,
                 boolean hasTime)
Creates a deathdate property.

Parameters:
date - the deathdate
hasTime - true to include the date's time component, false if it's strictly a date

Deathdate

public Deathdate(PartialDate partialDate)
Creates a deathdate property.

Parameters:
partialDate - the deathdate (vCard 4.0 only)

Deathdate

public Deathdate(String text)
Creates a deathdate property.

Parameters:
text - the text value (vCard 4.0 only)
Method Detail

_supportedVersions

public Set<VCardVersion> _supportedVersions()
Description copied from class: 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.

Overrides:
_supportedVersions in class VCardProperty
Returns:
the vCard versions that support this property.

getLanguage

public String getLanguage()
Description copied from class: VCardProperty
Gets the language that the property value is written in.

Returns:
the language or null if not set
See Also:
VCardParameters.getLanguage()

setLanguage

public void setLanguage(String language)
Description copied from class: VCardProperty
Sets the language that the property value is written in.

Parameters:
language - the language or null to remove
See Also:
VCardParameters.setLanguage(java.lang.String)


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.