1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.cdm.model.common;
|
5
|
|
6
|
|
7
|
/**
|
8
|
* Interface for all enumerations which provide a key for persisting them as strings
|
9
|
* via {@link EnumUserType}.
|
10
|
* The key may also be used for other purposes.
|
11
|
* The key must be unique within the enumeration.
|
12
|
*
|
13
|
* The interface also provides a human readable representation with i18n support.
|
14
|
*
|
15
|
* IMPORTANT: classes implementing this interface must also implement a static method
|
16
|
* <code>getByKey(String)</code> which returns the according instance. This can not be
|
17
|
* guaranteed by the interface as interfaces do not allow definitions of static methods.
|
18
|
*
|
19
|
* @author a.mueller
|
20
|
* @created 30-Aug-2013
|
21
|
*
|
22
|
*/
|
23
|
public interface IKeyTerm {
|
24
|
|
25
|
/**
|
26
|
* Returns the key for the enumeration.
|
27
|
* A key should be short unique identifier within the given enumeration.
|
28
|
* If not otherwise stated it should not be longer then 3 characters.
|
29
|
* @return the key
|
30
|
*/
|
31
|
public String getKey();
|
32
|
|
33
|
/**
|
34
|
* Returns a human readable preferably for the default language.
|
35
|
* @return
|
36
|
*/
|
37
|
public String getMessage();
|
38
|
|
39
|
/**
|
40
|
* Returns a human readable preferably for the given language.
|
41
|
* @param language
|
42
|
* @return
|
43
|
*/
|
44
|
public String getMessage(Language language);
|
45
|
|
46
|
}
|