private String validateDuration() {

        if (!isValidEndTypeForPattern()) {
            return Messages.ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0;
        }
        switch (getEndType()) {
            case DATE:
                return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS))
                ? null
                : Messages.ERR_SERIALDATE_SERIES_END_BEFORE_START_0;
            case TIMES:
                return getOccurrences() > 0 ? null : Messages.ERR_SERIALDATE_INVALID_OCCURRENCES_0;
            default:
                return null;
        }

    }
private String validateDuration ( ) { if ( ! isValidEndTypeForPattern ( ) ) { return Messages . ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0 ; } switch ( getEndType ( ) ) { case DATE : return ( getStart ( ) . getTime ( ) < ( getSeriesEndDate ( ) . getTime ( ) + DAY_IN_MILLIS ) ) ? null : Messages . ERR_SERIALDATE_SERIES_END_BEFORE_START_0 ; case TIMES : return getOccurrences ( ) > 0 ? null : Messages . ERR_SERIALDATE_INVALID_OCCURRENCES_0 ; default : return null ; } }
Checks if the provided duration information is valid.
@return <code>null</code> if the information is valid, the key of the suitable error message otherwise.