All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.fortuna.ical4j.validate.component.VTimeZoneValidator Maven / Gradle / Ivy

There is a newer version: 4.0.8
Show newest version
package net.fortuna.ical4j.validate.component;

import net.fortuna.ical4j.model.component.Observance;
import net.fortuna.ical4j.model.component.VTimeZone;
import net.fortuna.ical4j.validate.ComponentValidator;
import net.fortuna.ical4j.validate.ValidationException;
import net.fortuna.ical4j.validate.ValidationResult;
import net.fortuna.ical4j.validate.Validator;

@Deprecated
public class VTimeZoneValidator implements Validator {

    @Override
    public ValidationResult validate(VTimeZone target) throws ValidationException {
        ValidationResult result = ComponentValidator.VTIMEZONE.validate(target);

        /*
         * ; one of 'standardc' or 'daylightc' MUST occur ..; and each MAY occur more than once. standardc / daylightc /
         */
        if (target.getObservances().getComponent(Observance.STANDARD) == null
                && target.getObservances().getComponent(Observance.DAYLIGHT) == null) {
            throw new ValidationException("Sub-components ["
                    + Observance.STANDARD + "," + Observance.DAYLIGHT
                    + "] must be specified at least once");
        }
        target.getObservances().forEach(ComponentValidator.OBSERVANCE_ITIP::validate);
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy