colesico.framework.dslvalidator.commands.MandatoryGroup 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 execution is not interrupted when validation errors occur.
*
* If current context value is null throws validation exception.
*/
public class MandatoryGroup extends AbstractSequence {
private final ValidatorMessages msg;
public MandatoryGroup(ValidatorMessages msg) {
this.msg = msg;
}
@Override
public void execute(ValidationContext context) {
if (context.getValue() != null) {
executeGroup(context);
} else {
context.addError(MandatoryGroup.class.getSimpleName(), msg.mandatoryValueIsNull());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy