MCPcopy Create free account
hub / github.com/apache/poi / checkNonNullComparable

Method checkNonNullComparable

src/java/org/apache/poi/util/BinaryTree.java:1198–1211  ·  view source on GitHub ↗

check if an object is fit to be proper input ... has to be Comparable and non-null @param o the object being checked @param index _KEY or _VALUE (used to put the right word in the exception message) @exception NullPointerException if o is null @exception ClassCastException if o is not

(Object o,
                                               int index)

Source from the content-addressed store, hash-verified

1196 * @exception ClassCastException if o is not Comparable
1197 */
1198 private static void checkNonNullComparable(Object o,
1199 int index)
1200 {
1201 if (o == null)
1202 {
1203 throw new NullPointerException(_data_name[ index ]
1204 + " cannot be null");
1205 }
1206 if (!(o instanceof Comparable))
1207 {
1208 throw new ClassCastException(_data_name[ index ]
1209 + " must be Comparable");
1210 }
1211 }
1212
1213 /**
1214 * check a key for validity (non-null and implements Comparable)

Callers 3

doGetMethod · 0.95
checkKeyMethod · 0.95
checkValueMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected