1 16 package org.apache.commons.lang; 17 18 44 public class IllegalClassException extends IllegalArgumentException { 45 46 53 public IllegalClassException(Class expected, Object actual) { 54 super( 55 "Expected: " 56 + safeGetClassName(expected) 57 + ", actual: " 58 + (actual == null ? "null" : actual.getClass().getName())); 59 } 60 61 67 public IllegalClassException(Class expected, Class actual) { 68 super( 69 "Expected: " 70 + safeGetClassName(expected) 71 + ", actual: " 72 + safeGetClassName(actual)); 73 } 74 75 80 public IllegalClassException(String message) { 81 super(message); 82 } 83 84 91 private static final String safeGetClassName(Class cls) { 92 return cls == null ? null : cls.getName(); 93 } 94 95 } 96 | Popular Tags |