1 19 20 package org.netbeans.modules.schema2beans; 21 22 public class ValidateException extends Exception { 23 protected Object failedBean; 24 protected String failedPropertyName; 25 protected FailureType failureType; 26 27 public ValidateException(String msg, String failedPropertyName, Object failedBean) { 28 super(msg); 29 this.failedBean = failedBean; 30 this.failedPropertyName = failedPropertyName; 31 } 32 33 public ValidateException(String msg, FailureType ft, 34 String failedPropertyName, Object failedBean) { 35 super(msg); 36 this.failureType = ft; 37 this.failedBean = failedBean; 38 this.failedPropertyName = failedPropertyName; 39 } 40 41 public String getFailedPropertyName() {return failedPropertyName;} 42 public Object getFailedBean() {return failedBean;} 43 public FailureType getFailureType() {return failureType;} 44 45 public static class FailureType { 46 private final String name; 47 48 private FailureType(String name) {this.name = name;} 49 50 public String toString() { return name;} 51 52 public static final FailureType NULL_VALUE = new FailureType("NULL_VALUE"); 53 public static final FailureType DATA_RESTRICTION = new FailureType("DATA_RESTRICTION"); 54 public static final FailureType ENUM_RESTRICTION = new FailureType("ENUM_RESTRICTION"); 55 public static final FailureType ALL_RESTRICTIONS = new FailureType("ALL_RESTRICTIONS"); 56 public static final FailureType MUTUALLY_EXCLUSIVE = new FailureType("MUTUALLY_EXCLUSIVE"); 57 } 58 59 } 60 61 | Popular Tags |