1 17 package org.apache.bcel.verifier; 18 19 27 public class VerificationResult { 28 29 33 public static final int VERIFIED_NOTYET = 0; 34 35 public static final int VERIFIED_OK = 1; 36 37 public static final int VERIFIED_REJECTED = 2; 38 42 private static final String VERIFIED_NOTYET_MSG = "Not yet verified."; 43 44 private static final String VERIFIED_OK_MSG = "Passed verification."; 45 49 public static final VerificationResult VR_NOTYET = new VerificationResult(VERIFIED_NOTYET, 50 VERIFIED_NOTYET_MSG); 51 52 public static final VerificationResult VR_OK = new VerificationResult(VERIFIED_OK, 53 VERIFIED_OK_MSG); 54 55 private int numeric; 56 57 private String detailMessage; 58 59 60 61 public VerificationResult(int status, String message) { 62 numeric = status; 63 detailMessage = message; 64 } 65 66 67 68 public int getStatus() { 69 return numeric; 70 } 71 72 73 74 public String getMessage() { 75 return detailMessage; 76 } 77 78 79 81 public int hashCode() { 82 return numeric ^ detailMessage.hashCode(); 83 } 84 85 86 89 public boolean equals( Object o ) { 90 if (!(o instanceof VerificationResult)) { 91 return false; 92 } 93 VerificationResult other = (VerificationResult) o; 94 return ((other.numeric == this.numeric) && (other.detailMessage.equals(this.detailMessage))); 95 } 96 97 98 101 public String toString() { 102 String ret = ""; 103 if (numeric == VERIFIED_NOTYET) { 104 ret = "VERIFIED_NOTYET"; 105 } 106 if (numeric == VERIFIED_OK) { 107 ret = "VERIFIED_OK"; 108 } 109 if (numeric == VERIFIED_REJECTED) { 110 ret = "VERIFIED_REJECTED"; 111 } 112 ret += "\n" + detailMessage + "\n"; 113 return ret; 114 } 115 } 116 | Popular Tags |