blob: f3bd3a1de19ec13f977fdda9e0d96c28306148cd [file] [log] [blame]
margarethabf11d8d2017-10-24 19:31:44 +02001package de.ids_mannheim.korap.utils;
2
3import de.ids_mannheim.korap.exceptions.KustvaktException;
4import de.ids_mannheim.korap.exceptions.StatusCodes;
5
6public class ParameterChecker {
7
8 public static void checkObjectValue (Object obj, String name)
9 throws KustvaktException {
10 if (obj == null) {
11 throw new KustvaktException(StatusCodes.INVALID_ARGUMENT, name,
12 "null");
13 }
14 }
15
16 public static void checkStringValue (String string, String name)
17 throws KustvaktException {
18 if (string == null || string.isEmpty()) {
19 throw new KustvaktException(StatusCodes.INVALID_ARGUMENT, name,
20 string);
21 }
22 }
23
24 public static void checkIntegerValue (int integer, String name) throws KustvaktException {
25 if (integer == 0) {
26 throw new KustvaktException(StatusCodes.INVALID_ARGUMENT, name,
27 "0");
28 }
29 }
30
31}