private Object readResolve() throws ObjectStreamException {
        // The old index field used to uniquely identify the time unit.
        switch (index) {
        case 6:
            return SECOND;
        case 5:
            return MINUTE;
        case 4:
            return HOUR;
        case 3:
            return DAY;
        case 2:
            return WEEK;
        case 1:
            return MONTH;
        case 0:
            return YEAR;
        default:
            throw new InvalidObjectException("Bad index: " + index);
        }
    }
private Object readResolve ( ) throws ObjectStreamException { switch ( index ) { case 6 : return SECOND ; case 5 : return MINUTE ; case 4 : return HOUR ; case 3 : return DAY ; case 2 : return WEEK ; case 1 : return MONTH ; case 0 : return YEAR ; default : throw new InvalidObjectException ( "Bad index: " + index ) ; } }
For backward compatibility only