colesico.framework.dslvalidator.commands.MandatoryChain Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of colesico-validation Show documentation
Show all versions of colesico-validation Show documentation
Colesico framework data bean validation assistant and simple dsl validator
package colesico.framework.dslvalidator.commands;
import colesico.framework.dslvalidator.ValidationContext;
import colesico.framework.dslvalidator.t9n.ValidatorMessages;
/**
* If context value is not null executes all sequence commands within the current context.
* Commands executed until first validation error occurs.
*
* If current context value is null throws validation exception.
*/
public class MandatoryChain extends AbstractSequence {
private final ValidatorMessages msg;
public MandatoryChain(ValidatorMessages msg) {
this.msg = msg;
}
@Override
public void execute(ValidationContext context) {
if (context.getValue() != null) {
executeChain(context);
} else {
context.addError(MandatoryChain.class.getSimpleName(), msg.mandatoryValueIsNull());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy