]> git.basschouten.com Git - openhab-addons.git/blob
e12a2c704a43e519f583e988999537a0c42cde29
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.astro.internal.job;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * This class contains the default methods required for different jobs
19  *
20  * @author Amit Kumar Mondal - Initial contribution
21  */
22 @NonNullByDefault
23 public abstract class AbstractJob implements Job {
24
25     private final String thingUID;
26
27     public AbstractJob(String thingUID) {
28         this.thingUID = thingUID;
29     }
30
31     @Override
32     public String getThingUID() {
33         return thingUID;
34     }
35
36     /**
37      * Ensures the truth of an expression involving one or more parameters to the
38      * calling method.
39      *
40      * @param expression a boolean expression
41      * @param errorMessage the exception message to use if the check fails
42      * @throws IllegalArgumentException if {@code expression} is false
43      */
44     public static void checkArgument(boolean expression, String errorMessage) {
45         if (!expression) {
46             throw new IllegalArgumentException(errorMessage);
47         }
48     }
49 }