diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-01-12 16:48:02 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-01-16 15:54:31 (GMT) |
commit | 839db071f46d083b86996f514f5fe0f2d6aee80a (patch) | |
tree | 9f14beb42dcd82fa4deba10f516a0ba0368e57b5 /src/com/isode/stroke/base | |
parent | 3adee817bfcbd54fd13c4d946bedadeca661e9b1 (diff) | |
download | stroke-839db071f46d083b86996f514f5fe0f2d6aee80a.zip stroke-839db071f46d083b86996f514f5fe0f2d6aee80a.tar.bz2 |
Add support for DiscoItems and DiscoInfo.
Updates requisite classes in line with Swiften.
Also fixes bugs in the EventLoops not using handleEvent.
Diffstat (limited to 'src/com/isode/stroke/base')
-rw-r--r-- | src/com/isode/stroke/base/NotNull.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/com/isode/stroke/base/NotNull.java b/src/com/isode/stroke/base/NotNull.java new file mode 100644 index 0000000..f9bc87a --- /dev/null +++ b/src/com/isode/stroke/base/NotNull.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2012, Isode Limited, London, England. + * All rights reserved. + */ + +package com.isode.stroke.base; + +/** + * Helper to check for nulls. + */ +public class NotNull { + + /** + * Throws a NullPointerException if null. + * @param o Object to check for non-nullness + */ + public static void exceptIfNull(Object o) { + if (o == null) { + throw new NullPointerException(); + } + } + + /** + * Throws a NullPointerException if null. + * @param o Object to check for non-nullness + * @param name Variable name to include in error. + */ + public static void exceptIfNull(Object o, String name) { + if (name == null) { + throw new NullPointerException("Variable name passed to exceptIfNull must not be null"); + } + if (o == null) { + throw new NullPointerException(name + " must not be null"); + } + } +} |