net.fortuna.ical4j.validate.component.VTimeZoneValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ical4j Show documentation
Show all versions of ical4j Show documentation
A Java library for reading and writing iCalendar (*.ics) files
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