1 16 17 package org.apache.commons.latka.validators; 18 19 import org.apache.commons.latka.Validator; 20 import org.apache.commons.latka.ValidationException; 21 22 import org.apache.commons.latka.http.Response; 23 24 import org.apache.log4j.Category; 25 26 31 public abstract class BaseValidator implements Validator { 32 34 35 protected final Category _log = Category.getInstance(BaseValidator.class); 36 37 44 public abstract void validate(Response response) throws ValidationException; 45 46 protected String _label = null; 47 48 50 public BaseValidator() { 51 this(null); 52 } 53 54 public BaseValidator(String label) { 55 _label = label; 56 } 57 58 60 public void setLabel(String label) { 61 _label = label; 62 } 63 64 public String getLabel() { 65 return _label; 66 } 67 68 protected void fail(String reason) throws ValidationException { 69 throw new ValidationException(getLabel(),reason); 70 } 71 72 } 73 | Popular Tags |