1 17 package org.apache.geronimo.validator; 18 19 import java.util.*; 20 21 public class ValidationContext { 22 23 protected ArrayList failures = new ArrayList(); 24 protected ArrayList warnings = new ArrayList(); 25 protected ArrayList errors = new ArrayList(); 26 27 protected Map attributes = new HashMap(); 28 29 protected String jarPath; 30 31 public ValidationContext(String name){ 32 this.jarPath = name; 33 } 34 35 public Set entrySet() { 36 return attributes.entrySet(); 37 } 38 39 public Object remove(Object key) { 40 return attributes.remove(key); 41 } 42 43 public Object put(Object key, Object value) { 44 return attributes.put(key, value); 45 } 46 47 public Object get(Object key) { 48 return attributes.get(key); 49 } 50 51 public boolean containsKey(Object key) { 52 return attributes.containsKey(key); 53 } 54 55 public void addWarning( ValidationWarning warning ) { 56 warnings.add( warning ); 57 } 58 59 public void addFailure(ValidationFailure failure) { 60 failures.add( failure ); 61 } 62 63 public void addError(ValidationError error) { 64 errors.add( error ); 65 } 66 67 public ValidationFailure[] getFailures() { 68 return (ValidationFailure[])failures.toArray(new ValidationFailure[0]); 69 } 70 71 public ValidationWarning[] getWarnings() { 72 return (ValidationWarning[])failures.toArray(new ValidationWarning[0]); 73 } 74 75 public ValidationError[] getErrors() { 76 return (ValidationError[])failures.toArray(new ValidationError[0]); 77 } 78 79 public boolean hasWarnings(){ 80 return warnings.size() > 0; 81 } 82 83 public boolean hasFailures(){ 84 return failures.size() > 0; 85 } 86 87 public boolean hasErrors(){ 88 return errors.size() > 0; 89 } 90 } 91 | Popular Tags |