Elektra
0.9.6
|
Key represents an native Elektra key providing access to its name, value and meta information. More...
Inherits Iterable< String >.
Classes | |
enum | CreateArgumentTag |
Argument tags for use with create(String, Object...). More... | |
Public Member Functions | |
void | release () |
Clean-up method to release key reference by first decrementing its reference counter and then trying to free the native reference Call this method if you do not longer need a Key and obtained it via any of its public methods or the public methods of KeySet. More... | |
String | toString () |
Iterator< String > | iterator () |
boolean | getBoolean () |
boolean | getBooleanAndRelease () |
Return the key's value and releases this key. More... | |
byte | getByte () |
byte | getByteAndRelease () |
Return the key's value and releases this key. More... | |
short | getShort () |
short | getShortAndRelease () |
Return the key's value and releases this key. More... | |
int | getInt () |
int | getIntAndRelease () |
Return the key's value and releases this key. More... | |
long | getLong () |
long | getLongAndRelease () |
Return the key's value and releases this key. More... | |
float | getFloat () |
float | getFloatAndRelease () |
Return the key's value and releases this key. More... | |
double | getDouble () |
double | getDoubleAndRelease () |
Return the key's value and releases this key. More... | |
String | getString () throws KeyBinaryTypeNotSupportedException |
String | getStringAndRelease () throws KeyBinaryTypeNotSupportedException |
Return the key's value and releases this key. More... | |
Key | setBoolean (boolean value) |
Sets the key's value by converting. More... | |
Key | setByte (byte value) |
Sets the key's value by converting. More... | |
Key | setShort (short value) |
Sets the key's value by converting. More... | |
Key | setInt (int value) |
Sets the key's value by converting. More... | |
Key | setLong (long value) |
Sets the key's value by converting. More... | |
Key | setFloat (float value) |
Sets the key's value by converting. More... | |
Key | setDouble (double value) |
Sets the key's value by converting. More... | |
Key | setString (String value) |
Sets the key's value. More... | |
Key | setError (String text, Object... args) |
Sets proper error meta for key. More... | |
Key | addWarning (String text, Object... args) |
Adds warning meta for key. More... | |
Key | dup () |
Duplicates the key. More... | |
Key | dup (int flags) |
Duplicates the key. More... | |
Key | copy (Key source, int flags) |
Copies the information from the. More... | |
Key | rewindMeta () |
Rewinds the internal iterator for meta information of this key. More... | |
Key | nextMeta () |
Gets the next element of this key's internal meta information iterator. More... | |
Key | currentMeta () |
Gets the current element of this key's internal meta information iterator. More... | |
boolean | copyMeta (Key source, String metaName) |
Copies some meta information from a. More... | |
boolean | copyAllMeta (Key source) |
Copies all meta information from a. More... | |
Optional< Key > | getMeta (String metaName) |
Getter for meta information. More... | |
Key | setMeta (String metaName, String newMetaString) |
Sets meta information. More... | |
Key | removeMeta (String metaName) |
Removes meta information. More... | |
int | cmp (Key other) |
Compares this key with the. More... | |
boolean | isBelow (Key other) |
Checks whether this key is sub-key of the. More... | |
boolean | isBelowOrSame (Key other) |
Checks whether this key is the same as the. More... | |
boolean | isDirectBelow (Key other) |
Checks whether this key is direct sub-key of the. More... | |
boolean | isBinary () |
boolean | isString () |
String | getName () |
int | getNameSize () |
Key | setName (String name) |
Sets the key's name. More... | |
String | getBaseName () |
int | getBaseNameSize () |
Key | setBaseName (String baseName) throws KeyNameException |
Sets the key's base name; will replace current base name with new base name. More... | |
Key | addBaseName (String baseName) |
Adds key base name; will add given base name to current key so that new key is sub key of current key. More... | |
int | getValueSize () |
Static Public Member Functions | |
static Key | createNameless () |
Constructs a temporary nameless Key which cannot be saved to the key data base but used for transferring warnings and error information. More... | |
static Key | create (String name, @Nullable Object value, Key... meta) |
Constructs a new Key with the specified content and arguments More... | |
static Key | create (String name, Key... meta) |
Basic constructor of key class. More... | |
Static Public Attributes | |
static final int | KEY_CP_NAME = 1 << 0 |
Flag for use with copy(Key, int) for copying the key name. | |
static final int | KEY_CP_STRING = 1 << 1 |
Flag for use with copy(Key, int) for copying the key value, if it is a string. More... | |
static final int | KEY_CP_VALUE = 1 << 2 |
Flag for use with copy(Key, int) for copying the key value. More... | |
static final int | KEY_CP_META = 1 << 3 |
Flag for use with copy(Key, int) for copying the key metadata. | |
static final int | KEY_CP_ALL = KEY_CP_NAME | KEY_CP_VALUE | KEY_CP_META |
Flag for use with copy(Key, int) for copying the key name, value and metadata. | |
Protected Member Functions | |
Key (long nativePointer) | |
Constructor associating a new Key instance with a native pointer in long format. More... | |
Key (long nativePointer, boolean suppressCleanUp) | |
Constructor associating a new Key instance with a native pointer in long format Suppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case. More... | |
Key (Pointer pointer) | |
Constructor associating a new Key instance with a JNA pointer. More... | |
Key | incRef () |
Increments the reference counter for the underlying native key. More... | |
void | decRef () |
Decrements the reference counter for the underlying native key. More... | |
int | getRef () |
Gets the reference counter for the underlying native key. More... | |
Pointer | getPointer () |
Static Protected Member Functions | |
static Optional< Key > | create (@Nullable Pointer pointer) |
Constructs a new Key instance associated with a JNA pointer. More... | |
static Key | create (String name, Object... args) |
Constructs a new Key with the specified content and arguments More... | |
|
inlineprotected |
|
inlineprotected |
Constructor associating a new Key instance with a native pointer in long format
Suppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case.
nativePointer | Native pointer to key in long format |
suppressCleanUp | True to suppress native reference clean-up as soon as this Key instance becomes phantom reachable, false otherwise |
|
inlineprotected |
|
inline |
Adds key base name; will add given base name to current key so that new key is sub key of current key.
baseName | New key base name to add |
|
inline |
Adds warning meta for key.
text | Reason for the warning |
args | Custom arguments |
|
inline |
Compares this key with the.
keys by comparing the key name with string comparison
other | Other key to compare this key to |
KeyReleasedException | if this or the other
|
IllegalArgumentException | if other
null
|
Copies the information from the.
key into this key.
source | Source Key object containing the information to copy |
flags | Flags indicating which parts of the key to copy Example: KEY_CP_NAME | KEY_CP_VALUE |
KeyException | if copying failed |
KeyReleasedException | if this or the source
|
IllegalArgumentException | if source
null
|
|
inline |
Copies all meta information from a.
key to this key
source | Key used as source |
KeyMetaException | if copying failed |
KeyReleasedException | if this or the source
|
IllegalArgumentException | if source
null
|
|
inline |
Copies some meta information from a.
key to this key
KeyMetaException | if this key's meta information is read-only of copying failed |
KeyReleasedException | if this or the source
|
IllegalArgumentException | if source
null
metaName
|
|
inlinestaticprotected |
Constructs a new Key instance associated with a JNA pointer.
pointer | Optional JNA Pointer to key |
|
inlinestatic |
Constructs a new Key with the specified content and arguments
name | Key name; first part of key-value pair |
value | Key value; will be determine from the object by calling Object#toString(), null is supported too |
meta | Metadata that should be added to this key, null keys will be filtered away |
KeyNameException | if the key name is invalid |
|
inlinestatic |
|
inlinestaticprotected |
Constructs a new Key with the specified content and arguments
name | Key name; first part of key-value pair |
args | Arguments used for key value Example: CreateArgumentTag#KEY_VALUE, "custom key value", CreateArgumentTag#KEY_END |
KeyNameException | if the key name is invalid |
|
inlinestatic |
|
inline |
Gets the current element of this key's internal meta information iterator.
KeyReleasedException | if this Key has already been released |
NoSuchElementException | if no next meta key is available or internal iterator has been reset |
|
inlineprotected |
Decrements the reference counter for the underlying native key.
KeyReleasedException | if this Key has already been released |
|
inline |
Duplicates the key.
KeyException | if copying failed |
KeyReleasedException | if this Key has already been released |
|
inline |
Duplicates the key.
flags | Flags indicating which parts of the key to copy Example: KEY_CP_NAME | KEY_CP_VALUE |
KeyException | if copying failed |
KeyReleasedException | if this Key has already been released |
|
inline |
|
inline |
KeyReleasedException | if this Key has already been released |
|
inline |
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
NumberFormatException | if the getString() does not return a parsable byte
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable byte
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
NumberFormatException | if the getString() does not return a parsable double
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable double
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
NumberFormatException | if the getString() does not return a parsable float
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable float
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
NumberFormatException | if the getString() does not return a parsable integer |
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable integer |
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
NumberFormatException | if the getString() does not return a parsable long
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable long
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
Getter for meta information.
metaName | Key name of meta information to be fetched |
KeyReleasedException | if this Key has already been released |
IllegalArgumentException | if metaName
|
|
inline |
|
inline |
KeyReleasedException | if this Key has already been released |
|
inlineprotected |
KeyReleasedException | if this Key has already been released |
|
inlineprotected |
Gets the reference counter for the underlying native key.
KeyReleasedException | if this Key has already been released |
|
inline |
NumberFormatException | if the getString() does not return a parsable short
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
NumberFormatException | if the getString() does not return a parsable short
|
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released |
|
inline |
Return the key's value and releases this key.
KeyBinaryTypeNotSupportedException | if the underlying native key is of type binary |
KeyReleasedException | if this Key has already been released @apiNote This convenience method is primarily intended for facilityting early clean up in the case when a Key obtained via any of its public methods or the public methods of KeySet is just being read once and is not needed afterwards. |
|
inline |
KeyReleasedException | if this Key has already been released |
|
inlineprotected |
|
inline |
|
inline |
Checks whether this key is the same as the.
key or a sub-key of the
key
other | Key that is used in check as parent key |
KeyReleasedException | if this or the other
|
IllegalArgumentException | if other
null
|
|
inline |
KeyReleasedException | if this Key has already been released |
|
inline |
Checks whether this key is direct sub-key of the.
key
other | Key that is used in check as parent key |
KeyReleasedException | if this or the other
|
IllegalArgumentException | if other
null
|
|
inline |
KeyReleasedException | if this Key has already been released |
|
inline |
KeyReleasedException | if this Key has already been released |
|
inline |
Gets the next element of this key's internal meta information iterator.
KeyReleasedException | if this Key has already been released |
NoSuchElementException | if no next meta key is available |
|
inline |
Clean-up method to release key reference by first decrementing its reference counter and then trying to free the native reference
Call this method if you do not longer need a Key and obtained it via any of its public methods or the public methods of KeySet.
If you do not manually release such keys, they will get cleaned up by garbage collection as soon as they get phantom reachable. Therefore its encouraged to release key instances as soon as you do not use them anymore.
|
inline |
|
inline |
Rewinds the internal iterator for meta information of this key.
KeyReleasedException | if this Key has already been released |
|
inline |
Sets the key's base name; will replace current base name with new base name.
baseName | New key base name to use |
KeyNameException | if baseName
|
KeyReleasedException | if this Key has already been released |
IllegalArgumentException | if baseName
null
|
|
inline |
|
inline |
|
inline |
|
inline |
Sets proper error meta for key.
text | Reason for the error |
args | Custom arguments |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the key's name.
name | New key name to use |
|
inline |
|
inline |
|
inline |
|
static |
Flag for use with copy(Key, int) for copying the key value, if it is a string.
@apiNote Do not use together with KEY_CP_VALUE
|
static |
Flag for use with copy(Key, int) for copying the key value.
@apiNote Do not use together with KEY_CP_STRING