1
|
/**
|
2
|
* Copyright (C) 2021 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.format;
|
10
|
|
11
|
import org.apache.commons.lang3.StringUtils;
|
12
|
|
13
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
14
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
15
|
|
16
|
/**
|
17
|
* @author a.mueller
|
18
|
* @since 03.05.2021
|
19
|
*/
|
20
|
public abstract class CdmFormatterBase<T extends CdmBase> {
|
21
|
|
22
|
public abstract String format(T cdmBase);
|
23
|
|
24
|
protected boolean isBlank(String str){
|
25
|
return StringUtils.isBlank(str);
|
26
|
}
|
27
|
|
28
|
protected boolean isNotBlank(String str){
|
29
|
return StringUtils.isNotBlank(str);
|
30
|
}
|
31
|
|
32
|
/**
|
33
|
* Null safe string. Returns the given string if it is not <code>null</code>.
|
34
|
* Empty string otherwise.
|
35
|
* @see CdmUtils#Nz(String)
|
36
|
* @return the null-safe string
|
37
|
*/
|
38
|
protected String Nz(String str){
|
39
|
return CdmUtils.Nz(str);
|
40
|
}
|
41
|
|
42
|
}
|