01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf;
07:
08: import org.openrdf.model.Resource;
09:
10: /**
11: * General utility methods for OpenRDF/Sesame modules.
12: *
13: * @author Arjohn Kampman
14: */
15: public class OpenRDFUtil {
16:
17: /**
18: * Verifies that the supplied contexts parameter is not <tt>null</tt>,
19: * throwing an {@link IllegalArgumentException} if it is.
20: * <p>
21: * The semantics of supplying <tt>null</tt> as the value of the
22: * <tt>contexts</tt> vararg is not completely clear; it can either be
23: * equivalent to supplying an empty array (i.e.: matching all statements
24: * disregarding context), or to supplying a <tt>null</tt>-Resource value
25: * (e.g.: matching all statements with no associated context). As we so far
26: * haven't been able to prefer one over the other, methods operating on
27: * contexts currently throw {@link IllegalArgumentException}s.
28: *
29: * @param contexts
30: * The parameter to check.
31: * @throws IllegalArgumentException
32: * If the supplied contexts parameter is <tt>null</tt>.
33: */
34: public static void verifyContextNotNull(Resource... contexts) {
35: if (contexts == null) {
36: throw new IllegalArgumentException(
37: "Illegal value null array for contexts argument; either the value should be cast to Resource or an empty array should be supplied");
38: }
39: }
40: }
|