|
Elektra 0.11.0
|
Key represents a native Elektra key providing access to its name, value and meta information. More...
Classes | |
| enum | CreateArgumentTag |
Argument tags for use with create(String, Object...). More... | |
Public Member Functions | |
| byte[] | getBinary () |
| Key | setBoolean (boolean value) |
Sets the key's value by converting value to string. | |
| Key | setByte (byte value) |
Sets the key's value by converting value to string. | |
| Key | setShort (short value) |
Sets the key's value by converting value to string. | |
| Key | setInt (int value) |
Sets the key's value by converting value to string. | |
| Key | setLong (long value) |
Sets the key's value by converting value to string. | |
| Key | setFloat (float value) |
Sets the key's value by converting value to string. | |
| Key | setDouble (double value) |
Sets the key's value by converting value to string. | |
| Key | setString (String value) |
| Sets the key's value. | |
| Key | setBinary (byte[] value) |
| Sets the key's binary value. | |
| Key | setNull () |
| Removes the key's value without changing the type. | |
| Key | setError (ErrorCode code, String reason) |
| Sets proper error meta for key. | |
| Key | addWarning (ErrorCode code, String reason) |
| Adds warning meta for key. | |
| Key | copy (Key source, int flags) |
Copies the information from the source key into this key. | |
| boolean | copyMeta (Key source, String metaName) |
Copies some meta information from a source key to this key. | |
| boolean | copyAllMeta (Key source) |
Copies all meta information from a source key to this key. | |
| Optional< ReadableKey > | getMeta (String metaName) |
| Getter for meta information. | |
| Key | setMeta (String metaName, String newMetaString) |
| Sets meta information. | |
| Key | removeMeta (String metaName) |
| Removes meta information. | |
| KeySet | meta () |
| Get KeySet with metakeys. | |
| Key | setName (String name) |
| Sets the key's name. | |
| Key | setBaseName (String baseName) throws KeyNameException |
| Sets the key's base name; will replace current base name with new base name. | |
| 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. | |
| Iterator< ReadableKey > | iterator () |
Public Member Functions inherited from org.libelektra.ReadableKey | |
| String | toString () |
| Iterator< String > | keyNameIterator () |
| boolean | getBoolean () |
| byte | getByte () |
| short | getShort () |
| int | getInt () |
| long | getLong () |
| float | getFloat () |
| double | getDouble () |
| String | getString () |
| Key | dup () |
Duplicates this ReadableKey as Key. | |
| Key | dup (int flags) |
Duplicates this ReadableKey as Key. | |
| int | compareTo (ReadableKey other) |
Compares this key with the other key by comparing the key name with string comparison. | |
| boolean | isBelow (ReadableKey other) |
Checks whether this key is sub-key of the other key. | |
| boolean | isBelowOrSame (ReadableKey other) |
Checks whether this key is the same as the other key or a sub-key of the other key. | |
| boolean | isDirectlyBelow (ReadableKey other) |
Checks whether this key is direct sub-key of the other key. | |
| boolean | isBinary () |
| boolean | isString () |
| String | getName () |
| int | getNameSize () |
| String | getBaseName () |
| int | getBaseNameSize () |
| int | getValueSize () |
| boolean | isNull () |
Static Public Member Functions | |
| static Key | create () |
Constructs a temporary nameless Key which cannot be saved to the key data base but used for transferring warnings and error information. | |
| static Key | create (String name, @Nullable Object value, Key... meta) |
Constructs a new Key with the specified content and arguments | |
| static Key | create (String name, Key... meta) |
| Basic constructor of key class. | |
Protected Member Functions | |
| Key (long nativePointer, boolean suppressCleanUp) | |
Constructor associating a new Key instance with a native pointer in long formatSuppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case. | |
| Key (Pointer pointer) | |
Constructor associating a new Key instance with a JNA pointer. | |
| void | release () |
Clean-up method to release key reference by first decrementing its reference counter and then trying to free the native referencekeys, will get cleaned up by garbage collection as soon as they get phantom reachable. | |
Protected Member Functions inherited from org.libelektra.ReadableKey | |
| ReadableKey (Pointer pointer) | |
Constructor associating a new ReadableKey instance with a JNA pointer. | |
| ReadableKey (Pointer pointer, boolean suppressCleanUp) | |
Constructor associating a new ReadableKey instance with a JNA pointerSuppressing clean-up has been introduced for usage of this binding as JNI plug-in and should normally not be used in any other case. | |
| void | release () |
Clean-up method to release key reference by first decrementing its reference counter and then trying to free the native referencekeys, will get cleaned up by garbage collection as soon as they get phantom reachable. | |
| Pointer | getPointer () |
Static Protected Member Functions | |
| static Optional< Key > | create (@Nullable Pointer pointer) |
Constructs a new Key instance associated with a JNA pointer. | |
| static Key | create (String name, Object... args) |
Constructs a new Key with the specified content and arguments | |
Static Protected Member Functions inherited from org.libelektra.ReadableKey | |
| static Optional< ReadableKey > | createReadOnly (@Nullable Pointer pointer) |
Constructs a new ReadableKey instance associated with a JNA pointer. | |
Additional Inherited Members | |
Static Public Attributes inherited from org.libelektra.ReadableKey | |
| static final int | KEY_CP_NAME = 1 << 0 |
Flag for use with Key#copy(Key, int) and dup(int) for copying the key name. | |
| static final int | KEY_CP_STRING = 1 << 1 |
Flag for use with Key#copy(Key, int) and dup(int) for copying the key value, if it is a string. | |
| static final int | KEY_CP_VALUE = 1 << 2 |
Flag for use with Key#copy(Key, int) and dup(int) for copying the key value. | |
| static final int | KEY_CP_META = 1 << 3 |
Flag for use with Key#copy(Key, int) and dup(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 Key#copy(Key, int) and dup(int) for copying the key name, value and metadata. | |
Key represents a native Elektra key providing access to its name, value and meta information.
|
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 @implNote Increased the native key's reference counter, even if suppressCleanUp is true |
|
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 |
Key, enabling a fluent interface
|
inline |
Copies the information from the source 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 |
Key, enabling a fluent interface | KeyException | if copying failed |
| IllegalStateException | if this or the source Key has already been released |
| IllegalArgumentException | if source is null |
|
inline |
Copies all meta information from a source key to this key.
| source | Key used as source |
source does not contain any meta and nothing had to be done | KeyMetaException | if copying failed |
| IllegalStateException | if this or the source Key has already been released |
| IllegalArgumentException | if source is null |
|
inline |
Copies some meta information from a source key to this key.
| source | Key used as source |
| metaName | Key name of the meta information to be copied |
| KeyMetaException | if this key's meta information is read-only of copying failed |
| IllegalStateException | if this or the source Key has already been released |
| IllegalArgumentException | if source is null or metaName is blank |
|
inlinestatic |
Constructs a temporary nameless Key which cannot be saved to the key data base but used for transferring warnings and error information.
| KeyException | on allocation problems |
|
inlinestaticprotected |
Constructs a new Key instance associated with a JNA pointer.
| pointer | Optional JNA Pointer to key |
Key instance if pointer is non-null, Optional#empty() otherwise
|
inlinestatic |
Constructs a new Key with the specified content and arguments
| name | Name of the key (first part of key-value pair) |
| value | Optional Value of key. will be determine from the object by calling Object#toString(). To set a binary value, please see setBinary(byte[]). |
| meta | Metadata that should be added to this key, null keys will be filtered away |
| KeyException | if the key name is invalid or there have been allocation problems |
|
inlinestatic |
Basic constructor of key class.
| name | Key name; first part of key-value pair |
| meta | Metadata that should be added to this key. Will filter null values. |
| KeyException | if the key name is invalid or there have been allocation problems |
|
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 |
| KeyException | if the key name is invalid or there have been allocation problems |
|
inline |
| KeyBinaryValueException | if the underlying native key is not of type binary |
| IllegalStateException | if this Key has already been released |
|
inline |
Getter for meta information.
| metaName | Key name of meta information to be fetched |
ReadableKey object containing the requested meta information or Optional#empty(), if metaName was not found
|
inline |
KeySetIterator for the meta data of this Key
|
inline |
Get KeySet with metakeys.
| KeyMetaException | if k is invalid |
| IllegalStateException | if this Key has already been released |
| IllegalArgumentException | if k is null} |
|
inline |
|
inline |
Sets the key's base name; will replace current base name with new base name.
| baseName | New key base name to use |
Key, enabling a fluent interface | KeyNameException | if baseName is invalid, the key was inserted in a key set before or the key name is read-only |
| IllegalStateException | if this Key has already been released |
| IllegalArgumentException | if baseName is null |
|
inline |
|
inline |
Sets the key's value by converting value to string.
| value | Value to set |
Key, enabling a fluent interface | IllegalStateException | if this Key has already been released |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets meta information.
| metaName | Key name of meta information to be set |
| newMetaString | Meta value to be set |
Key, enabling a fluent interface
|
inline |
Sets the key's name.
| name | New key name to use |
Key, enabling a fluent interface
|
inline |
|
inline |
|
inline |