Package org.apache.sis.util.resources
Class KeyConstants
java.lang.Object
org.apache.sis.util.resources.KeyConstants
- Direct Known Subclasses:
Errors.Keys
,Messages.Keys
,Resources.Keys
,Resources.Keys
,Resources.Keys
,Resources.Keys
,Resources.Keys
,Resources.Keys
,Resources.Keys
,Vocabulary.Keys
Base class of
Keys
inner classes declaring key constants.
This base class provides methods for fetching a key numeric value
from its name and conversely.- Since:
- 0.8
- Version:
- 0.8
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String[]
The key names in the exact same order thanIndexedResourceBundle.values
.private final Class
<?> The class that defines key constants. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
For sub-classes constructors only.(package private)
KeyConstants
(Class<?> keysClass) Creates a new instance for key constants defined in an independent class. -
Method Summary
Modifier and TypeMethodDescription(package private) final String
getKeyName
(short index) Returns the name of the key at the given index.(package private) final String[]
Returns the internal array of key names.(package private) final short
getKeyValue
(String name) Returns the numerical value for the key of the given name.
-
Field Details
-
keysClass
The class that defines key constants. -
keys
The key names in the exact same order thanIndexedResourceBundle.values
. This is usually not needed, but may be created from theKeys
inner class in some occasions.- See Also:
-
-
Constructor Details
-
KeyConstants
protected KeyConstants()For sub-classes constructors only. -
KeyConstants
KeyConstants(Class<?> keysClass) Creates a new instance for key constants defined in an independent class.
-
-
Method Details
-
getKeyNames
Returns the internal array of key names. Do not modify the returned array. This method should usually not be invoked, in order to avoid loading the inner Keys class. The keys names are used only in rare situation, likeIndexedResourceBundle.list(Appendable)
or in log records. -
getKeyName
Returns the name of the key at the given index. If there is no name at that given index, formats the index as a decimal number. Those decimal numbers are parsed by ourIndexedResourceBundle.handleGetObject(String)
implementation. -
getKeyValue
Returns the numerical value for the key of the given name.
-