1
|
/**
|
2
|
* Copyright (C) 2019 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.model.common;
|
10
|
|
11
|
/**
|
12
|
* @author a.mueller
|
13
|
* @since 22.01.2019
|
14
|
*
|
15
|
*/
|
16
|
public interface IHasTermType {
|
17
|
|
18
|
public TermType getTermType();
|
19
|
|
20
|
public static void checkTermTypeNull(IHasTermType term) {
|
21
|
if (term.getTermType()== null){
|
22
|
throw new IllegalArgumentException("Term types must not be null");
|
23
|
}
|
24
|
}
|
25
|
public static void checkTermTypes(IHasTermType term, IHasTermType term2) {
|
26
|
if (term != null && term2 != null){
|
27
|
checkTermTypeNull(term);
|
28
|
checkTermTypeNull(term2);
|
29
|
if (term.getTermType()!= term2.getTermType()){
|
30
|
throw new IllegalArgumentException("Term types must match");
|
31
|
}
|
32
|
}
|
33
|
}
|
34
|
}
|