org.dashbuilder.dataset.validation.IsTimeIntervalImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dashbuilder-dataset-api
Show all versions of dashbuilder-dataset-api
Dashbuilder Dataset API shared between client and server.
The newest version!
package org.dashbuilder.dataset.validation;
import org.dashbuilder.dataset.date.TimeAmount;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
* JSR303 annotation implementation for org.dashbuilder.common.shared.validation.IsTimeInterval
.
*/
public class IsTimeIntervalImpl implements ConstraintValidator {
@Override
public void initialize(IsTimeInterval constraintAnnotation) {
// Do nothing.
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value != null && value.trim().length() > 0) {
try {
TimeAmount.parse(value);
} catch (IllegalArgumentException e) {
return false;
}
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy