public GregorianCalendar getExpiredDate ( GregorianCalendar relativeDate ) { // Get today's date and adjust by the specified age. GregorianCalendar expiredDate = ( GregorianCalendar ) relativeDate . clone ( ) ; switch ( m_units ) { case DAYS : expiredDate . add ( Calendar . DAY_OF_MONTH , - m_value ) ; break ; case MONTHS : expiredDate . add ( Calendar . MONTH , - m_value ) ; break ; case YEARS : expiredDate . add ( Calendar . YEAR , - m_value ) ; break ; default : // New value we forgot to add here? throw new AssertionError ( "Unknown RetentionUnits: " + m_units ) ; } return expiredDate ; }
Find the date on or before which objects expire based on the given date and the retention age specified in this object . The given date is cloned and then adjusted downward by the units and value in this RetentionAge .