com.neotys.neoload.model.validation.constraintvalidators.StopAfterValidator Maven / Gradle / Ivy
package com.neotys.neoload.model.validation.constraintvalidators;
import javax.validation.ConstraintValidatorContext;
import com.neotys.neoload.model.scenario.StopAfter;
import com.neotys.neoload.model.validation.constraints.CompositeCheck;
/**
* @deprecated As of v3, replaced by an associated class from v3 version.
*/
@Deprecated
public final class StopAfterValidator extends AbstractConstraintValidator {
@Override
public boolean isValid(final StopAfter stopAfter, final ConstraintValidatorContext context) {
if (stopAfter == null) {
return false;
}
final StopAfter.Type type = stopAfter.getType();
if (type == null) {
return false;
}
final Object value = stopAfter.getValue();
if (type == StopAfter.Type.TIME) {
if (value == null) {
return false;
}
if (!(value instanceof Integer)) {
return false;
}
return ((Integer) value > 0);
}
else {
return (value == null);
}
}
}