public interface Key
Modifier and Type | Method and Description |
---|---|
static <T extends Key> |
checkAndGetIfValid(T key)
Checks if key passed as argument is not
null and its value is not null as well.If not, throw a IllegalArgumentException , otherwise it returns the key. |
static void |
checkIfValid(Key key)
Checks if key passed as argument is not
null and its value is not null as well.If not, throw a IllegalArgumentException . |
static int |
compare(Key k1,
Key k2)
Compares the two specified key values.
|
static Key |
create(String key)
Returns a key instance by its string value.
|
static boolean |
equals(Key k1,
Key k2)
Returns
true if the keys have got the same value. |
static <T extends Key> |
getKeyByValue(T[] enumValues,
String value)
Returns a key in the an enumeration by the value.
|
static <T extends Key> |
getKeyByValue(T[] enumValues,
String value,
T defaultKey)
Returns a key in the an enumeration by the value, or the default key passed as argument.
|
static <T extends Key> |
hasKeyByValue(T[] enumValues,
String value)
Returns
true if a key in the an enumeration is related to the value, otherwise false . |
static boolean |
isValid(Key key)
Returns
true if key passed as argument is not null and its value is not null as well. |
String |
value()
Returns the name value of property
|
static Key create(String key)
key
- string value to usestatic boolean isValid(Key key)
true
if key passed as argument is not null
and its value is not null
as well.key
- key to be checkedtrue
if key passed as argument is not null
and its value is not null
as well.static void checkIfValid(Key key)
null
and its value is not null
as well.IllegalArgumentException
.key
- key to be checkedstatic <T extends Key> T checkAndGetIfValid(T key)
null
and its value is not null
as well.IllegalArgumentException
, otherwise it returns the key.T
- type of keykey
- key to be checkedstatic <T extends Key> boolean hasKeyByValue(T[] enumValues, String value)
true
if a key in the an enumeration is related to the value, otherwise false
.T
- type of keyenumValues
- enumeration values of keysvalue
- value to search in the keytrue
if a key in the an enumeration is related to the value, otherwise false
static <T extends Key> T getKeyByValue(T[] enumValues, String value)
T
- type of keyenumValues
- enumeration values of keysvalue
- value to search in the keynull
static <T extends Key> T getKeyByValue(T[] enumValues, String value, T defaultKey)
T
- type of keyenumValues
- enumeration values of keysvalue
- value to search in the keydefaultKey
- default key instance if the value is not foundstatic int compare(Key k1, Key k2)
k1
- the first key to comparek2
- the second key to comparestatic boolean equals(Key k1, Key k2)
true
if the keys have got the same value.k1
- the first key to comparek2
- the second key to comparetrue
if the keys have got the same valueString value()