1 20 package org.enhydra.barracuda.core.forms; 21 22 import java.util.*; 23 24 import org.enhydra.barracuda.core.forms.*; 25 import org.enhydra.barracuda.plankton.*; 26 27 41 public class Not extends AbstractFormValidator { 42 43 protected FormValidator fv = null; 44 45 50 public Not(FormValidator ifv) { 51 this(ifv, null); 52 } 53 54 60 public Not(FormValidator ifv, String ierrmsg) { 61 setErrorMessage(ierrmsg); 62 fv = ifv; 63 } 64 65 70 public FormValidator getSubValidator() { 71 return fv; 72 } 73 74 89 public void validate(FormElement element, FormMap map, boolean deferExceptions) throws ValidationException { 90 if (localLogger.isDebugEnabled()) localLogger.debug("Making sure "+fv+" is not valid"); 91 92 boolean throwEx = true; 93 94 if (fv!=null) try { 96 fv.validate(element, map, deferExceptions); 98 } catch (ValidationException ve) { 99 if (localLogger.isDebugEnabled()) localLogger.debug(fv+" is not valid, so we continue."); 100 throwEx = false; 101 } 103 104 if (throwEx) { 105 throw this.generateException(element, deferExceptions, "Validator "+fv+" was valid (and it shouldn't have been!)"); 107 } 108 } 109 110 } 111 | Popular Tags |