1 22 package org.jboss.util; 23 24 31 public class NullArgumentException 32 extends IllegalArgumentException 33 { 34 35 protected final String name; 36 37 38 protected final Object index; 39 40 45 public NullArgumentException(final String name) { 46 super(makeMessage(name)); 47 48 this.name = name; 49 this.index = null; 50 } 51 52 58 public NullArgumentException(final String name, final long index) { 59 super(makeMessage(name, new Long (index))); 60 61 this.name = name; 62 this.index = new Long (index); 63 } 64 65 71 public NullArgumentException(final String name, final Object index) { 72 super(makeMessage(name, index)); 73 74 this.name = name; 75 this.index = index; 76 } 77 78 81 public NullArgumentException() { 82 this.name = null; 83 this.index = null; 84 } 85 86 91 public final String getArgumentName() { 92 return name; 93 } 94 95 100 public final Object getArgumentIndex() { 101 return index; 102 } 103 104 107 private static String makeMessage(final String name) { 108 return "'" + name + "' is null"; 109 } 110 111 114 private static String makeMessage(final String name, final Object index) { 115 return "'" + name + "[" + index + "]' is null"; 116 } 117 } 118 | Popular Tags |