boolean validateInChoose(Context context) { return doValidate(context); } }
boolean validateInChoose(Context context) { return doValidate(context); } }
public boolean validate(Context context) { for (Validator validator : getValidators()) { if (validator instanceof When) { When when = (When) validator; Condition cond = when.condition; if (cond.isSatisfied(context)) { return when.validateInChoose(context); } } else if (validator instanceof Otherwise) { Otherwise ow = (Otherwise) validator; return ow.validateInChoose(context); } } return true; }
@Override protected boolean validate(Context context, Object[] values) { Validator validator = getValidator(); for (Object value : values) { Context newContext = newContext(context, validator, value); if (validator.validate(newContext)) { return false; } } return true; }
public boolean validate(Context context) { for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (validator.validate(newContext)) { return false; } } return true; }
public boolean validate(Context context) { for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (!validator.validate(newContext)) { context.setMessage(validator.getMessage(newContext)); return false; } } return true; }
public boolean validate(Context context) { List<String> messages = createArrayList(getValidators().size()); context.getMessageContext().put("allMessages", messages); for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (validator.validate(newContext)) { return true; } else { messages.add(validator.getMessage(newContext)); } } return false; }
@Override protected void doParseElement(Element element, ParserContext parserContext, BeanDefinitionBuilder chooseBuilder) { ElementSelector whenSelector = and(sameNs(element), name("when")); ElementSelector otherwiseSelector = and(sameNs(element), name("otherwise")); List<Object> validators = createManagedList(element, parserContext); for (Element subElement : subElements(element)) { if (whenSelector.accept(subElement)) { validators.add(parseWhen(subElement, parserContext)); } else if (otherwiseSelector.accept(subElement)) { validators.add(parseOtherwise(subElement, parserContext)); } } chooseBuilder.addPropertyValue("validators", validators); }
public boolean validate(Context context) { return !condition.isSatisfied(context) || doValidate(context); }
@Override protected void init() throws Exception { List<Validator> validators = getValidators(); assertTrue(!validators.isEmpty(), "no validators"); for (Iterator<Validator> i = validators.iterator(); i.hasNext(); ) { Validator validator = i.next(); if (i.hasNext()) { assertTrue(validator instanceof When, "expected <when>"); } else { assertTrue(validator instanceof When || validator instanceof Otherwise, "expected <when> or <otherwise>"); } } }
public boolean validate(Context context) { for (Validator validator : getValidators()) { if (validator instanceof When) { When when = (When) validator; Condition cond = when.condition; if (cond.isSatisfied(context)) { return when.validateInChoose(context); } } else if (validator instanceof Otherwise) { Otherwise ow = (Otherwise) validator; return ow.validateInChoose(context); } } return true; }
@Override protected boolean validate(Context context, Object[] values) { Validator validator = getValidator(); for (Object value : values) { Context newContext = newContext(context, validator, value); if (validator.validate(newContext)) { return false; } } return true; }
public boolean validate(Context context) { for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (validator.validate(newContext)) { return false; } } return true; }
public boolean validate(Context context) { for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (!validator.validate(newContext)) { context.setMessage(validator.getMessage(newContext)); return false; } } return true; }
public boolean validate(Context context) { List<String> messages = createArrayList(getValidators().size()); context.getMessageContext().put("allMessages", messages); for (Validator validator : getValidators()) { Context newContext = newContext(context, validator); if (validator.validate(newContext)) { return true; } else { messages.add(validator.getMessage(newContext)); } } return false; }
@Override protected void doParseElement(Element element, ParserContext parserContext, BeanDefinitionBuilder chooseBuilder) { ElementSelector whenSelector = and(sameNs(element), name("when")); ElementSelector otherwiseSelector = and(sameNs(element), name("otherwise")); List<Object> validators = createManagedList(element, parserContext); for (Element subElement : subElements(element)) { if (whenSelector.accept(subElement)) { validators.add(parseWhen(subElement, parserContext)); } else if (otherwiseSelector.accept(subElement)) { validators.add(parseOtherwise(subElement, parserContext)); } } chooseBuilder.addPropertyValue("validators", validators); }
boolean validateInChoose(Context context) { return doValidate(context); } }
boolean validateInChoose(Context context) { return doValidate(context); } }
public boolean validate(Context context) { return !condition.isSatisfied(context) || doValidate(context); }
@Override protected void init() throws Exception { List<Validator> validators = getValidators(); assertTrue(!validators.isEmpty(), "no validators"); for (Iterator<Validator> i = validators.iterator(); i.hasNext(); ) { Validator validator = i.next(); if (i.hasNext()) { assertTrue(validator instanceof When, "expected <when>"); } else { assertTrue(validator instanceof When || validator instanceof Otherwise, "expected <when> or <otherwise>"); } } }