Elektra
0.9.8
|
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 | |
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... | |
byte[] | getBinary () |
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 | setBinary (byte[] value) |
Sets the key's binary 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 | copy (Key source, int flags) |
Copies the information from the. More... | |
Key | rewindMeta () |
Rewinds the internal iterator for meta information of this key. More... | |
Optional< ReadableKey > | nextMeta () |
Gets the next element of this key's internal meta information iterator. More... | |
ReadableKey | 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< ReadableKey > | 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... | |
Key | setName (String name) |
Sets the key's name. More... | |
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... | |
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. More... | |
Key | dup (int flags) |
Duplicates this ReadableKey as Key. More... | |
int | compareTo (ReadableKey other) |
Compares this key with the. More... | |
boolean | isBelow (ReadableKey other) |
Checks whether this key is sub-key of the. More... | |
boolean | isBelowOrSame (ReadableKey other) |
Checks whether this key is the same as the. More... | |
boolean | isDirectlyBelow (ReadableKey other) |
Checks whether this key is direct sub-key of the. More... | |
boolean | isBinary () |
boolean | isString () |
String | getName () |
int | getNameSize () |
String | getBaseName () |
int | getBaseNameSize () |
int | getValueSize () |
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. 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... | |
Protected Member Functions | |
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... | |
Protected Member Functions inherited from org.libelektra.ReadableKey | |
ReadableKey (Pointer pointer) | |
Constructor associating a new ReadableKey instance with a JNA pointer. More... | |
ReadableKey (Pointer pointer, boolean suppressCleanUp) | |
Constructor associating a new ReadableKey instance with a JNA pointer 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... | |
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... | |
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. More... | |
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. More... | |
static final int | KEY_CP_VALUE = 1 << 2 |
Flag for use with Key#copy(Key, int) and dup(int) for copying the key value. More... | |
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 |
|
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 error (format pattern) |
args | Custom arguments to the format pattern text
|
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 |
IllegalStateException | 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 |
IllegalStateException | 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 |
IllegalStateException | if this or the source
|
IllegalArgumentException | if source
null
metaName
|
|
inlinestatic |
|
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 | Name of the key (first part of key-value pair) |
value | Optional Value of key. will be determine from the object by calling {}. To set a binary value, please see #setBinary(byte[])}. meta Metadata that should be added to this key, null keys will be filtered away New key KeyException if the key name is invalid or there have been allocation problems #release() |
|
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 |
KeyException | if the key name is invalid or there have been allocation problems |
|
inline |
Gets the current element of this key's internal meta information iterator.
IllegalStateException | if this Key has already been released |
NoSuchElementException | if no current meta key is available or internal iterator has been reset |
|
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 |
|
inline |
|
inline |
Gets the next element of this key's internal meta information iterator.
|
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.
Reimplemented from org.libelektra.ReadableKey.
|
inline |
|
inline |
Rewinds the internal iterator for meta information of this key.
IllegalStateException | 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
|
IllegalStateException | if this Key has already been released |
IllegalArgumentException | if baseName
null
|
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets proper error meta for key.
text | Reason for the error (format pattern) |
args | Custom arguments to the format pattern text
|
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the key's name.
name | New key name to use |
|
inline |
|
inline |