Scroll to navigation

org.libelektra.Key(3elektra) Elektra org.libelektra.Key(3elektra)

NAME

org.libelektra.Key - Key is an essential class that encapsulates key name , value and metainfo.

SYNOPSIS

Inherits Iterable< String >.

Public Member Functions


void release ()
Clean-up method to release key reference. boolean isNull ()
Helper function that does null comparison. String toString ()
Basic java function that represents object as String. java.util.Iterator< String > iterator ()
Iterable interface function. boolean getBoolean ()
Data type specific accessor function. byte getByte ()
Data type specific accessor function. short getShort ()
Data type specific accessor function. int getInteger ()
Data type specific accessor function. long getLong ()
Data type specific accessor function. float getFloat ()
Data type specific accessor function. double getDouble ()
Data type specific accessor function. void setBoolean (final boolean v)
Data type specific setter function. void setByte (final byte v)
Data type specific setter function. void setShort (final short v)
Data type specific setter function. void setInteger (final int v)
Data type specific setter function. void setLong (final long v)
Data type specific setter function. void setFloat (final float v)
Data type specific setter function. void setDouble (final double v)
Data type specific setter function. void setError (final String text, final Object... args)
Helper function to set proper error meta for key. void addWarning (final String text, final Object... args)
Helper function to add warning meta for key. Key dup ()
Duplicates the key. void copy (final Key source)
Copies the information from the source key into this key. int getRef ()
Gets the reference counter for this key. int rewindMeta ()
Tries to rewind the meta information for this key. Key nextMeta ()
Gets the next meta information for this key. Key currentMeta ()
Gets the current meta information for this key. int copyMeta (final Key source, final String metaName)
Helper function to copy some meta information from a source Key to this key. int copyAllMeta (final Key source)
Helper function to copy all meta information from a source key to this key. Key getMeta (final String metaName)
Getter for meta information. int setMeta (final String metaName, final String newMetaString)
Setter for meta information. int cmp (final Key other)
Helper function to compare two keys. int rel (final Key other)
Helper function to check for relation between keys. int needsSync ()
Helper function to check if synchronization is necessary. boolean isBelow (final Key other)
Helper function to check if key is sub-key of other key. boolean isBelowOrSame (final Key other)
Helper function to check if key is other key or sub-key of other key. boolean isDirectBelow (final Key other)
Helper function to check if key is direct sub-key of other key. boolean isInactive ()
Helper function to check if key is set to inactive. boolean isBinary ()
Helper function to check if key is binary key. boolean isString ()
Helper function to check if key is string key. String getName ()
Helper function to get key name (key part of 'key-value' pair) int getNameSize ()
Helper function to get key name size. void setName (final String name) throws KeyInvalidName
Helper function to set key name. String getBaseName ()
Helper function to get key base name. int getBaseNameSize ()
Helper function to get key base name length. void setBaseName (final String baseName) throws KeyInvalidName
Helper function to set key base name; will replace current base name with new base name. void addBaseName (final String baseName) throws KeyInvalidName
Helper function to add key base name; will add given base name to current key so that new key is sub key of current key. int getValueSize ()
Helper function to get key value size/length. String getString () throws KeyTypeMismatch
Helper function to get representation of key value. int setString (final String newString)
Helper function to set new key value.

Static Public Member Functions


static Key create (final String name, final Object value, final Key... meta)
Basic constructor of key class. static Key create (final String name, final Key... meta)
Basic constructor of key class.

Protected Member Functions


Key (final long p)
Helper constructor for duplication by pointer in long format. Key (final Pointer p)
Helper constructor for duplication by pointer. void finalize () throws Throwable
Clean-up method to inform underlying c-library about the release of the key reference in jna-binding. void incRef ()
Increments the reference counter for this key. void decRef ()
Decrements the reference counter for this key. Pointer get ()
Native pointer used by JNA.

Static Protected Member Functions


static Key create (final String name, final Object... args)
Basic constructor of key class.

Detailed Description

Key is an essential class that encapsulates key name , value and metainfo.

Constructor & Destructor Documentation

org.libelektra.Key.Key (final long p) [inline], [protected]

Helper constructor for duplication by pointer in long format.

Parameters:

p Pointer in long format

org.libelektra.Key.Key (final Pointer p) [inline], [protected]

Helper constructor for duplication by pointer.

Parameters:

p Pointer as Pointer object

Member Function Documentation

void org.libelektra.Key.addBaseName (final String baseName) throws KeyInvalidName [inline]

Helper function to add key base name; will add given base name to current key so that new key is sub key of current key.

Parameters:

baseName New key base name to add

Exceptions:

KeyInvalidName

void org.libelektra.Key.addWarning (final String text, final Object... args) [inline]

Helper function to add warning meta for key.

Parameters:

text Reason for the warning
args Custom arguments

int org.libelektra.Key.cmp (final Key other) [inline]

Helper function to compare two keys. Compares the key name with normal String comparison.

Parameters:

other Other Key object that is used in comparison

Returns:

0 if key name is equal; -1 if this key name has lower alphabetical order than the other key; 1 if this key has higher alphabetical order

void org.libelektra.Key.copy (final Key source) [inline]

Copies the information from the source key into this key. Does nothing if null is provided.

Parameters:

source Source Key object containing the information to copy

int org.libelektra.Key.copyAllMeta (final Key source) [inline]

Helper function to copy all meta information from a source key to this key.

Parameters:

source Key object that is used as source

Returns:

1 if meta was successfully copied, 0 if source doesn't contain any meta and nothing had to be done, -1 in case of an error or if the source parameter was null

int org.libelektra.Key.copyMeta (final Key source, final String metaName) [inline]

Helper function to copy some meta information from a source Key to this key.

Parameters:

source Key object that is used as source
metaName Key name of the meta to be copied

Returns:

1 if meta was successfully copied, 0 if source doesn't contain the required meta and nothing had to be done, -1 in case of an error or if the source parameter was null

static Key org.libelektra.Key.create (final String name, final Object... args) [inline], [static], [protected]

Basic constructor of key class.

Parameters:

name Key name; first part of key-value pair
args Arguments used for key value. Example:
Key.KEY_VALUE, 'custom key value', Key.KEY_END

Returns:

New key object

static Key org.libelektra.Key.create (final String name, final Object value, final Key... meta) [inline], [static]

Basic constructor of key class.

Parameters:

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

Returns:

New key object

static Key org.libelektra.Key.create (final String name, final Key... meta) [inline], [static]

Basic constructor of key class.

Parameters:

name Key name; first part of key-value pair
meta Metadata that should be added to this key. Will filter null values.

Returns:

New key object

Key org.libelektra.Key.currentMeta () [inline]

Gets the current meta information for this key.

Returns:

new Key object containing the current meta information

Key org.libelektra.Key.dup () [inline]

Duplicates the key.

Returns:

New Key object containing the same information as this key

Pointer org.libelektra.Key.get () [inline], [protected]

Native pointer used by JNA.

Returns:

Native pointer object for this key

String org.libelektra.Key.getBaseName () [inline]

Helper function to get key base name.

Returns:

Key base name as String

int org.libelektra.Key.getBaseNameSize () [inline]

Helper function to get key base name length.

Returns:

Length of key base name

boolean org.libelektra.Key.getBoolean () [inline]

Data type specific accessor function.

Returns:

Key value in boolean format

byte org.libelektra.Key.getByte () [inline]

Data type specific accessor function.

Returns:

Key value in byte format

double org.libelektra.Key.getDouble () [inline]

Data type specific accessor function.

Returns:

Key value in double format

float org.libelektra.Key.getFloat () [inline]

Data type specific accessor function.

Returns:

Key value in float format

int org.libelektra.Key.getInteger () [inline]

Data type specific accessor function.

Returns:

Key value in integer format

long org.libelektra.Key.getLong () [inline]

Data type specific accessor function.

Returns:

Key value in long integer format

Key org.libelektra.Key.getMeta (final String metaName) [inline]

Getter for meta information.

Parameters:

metaName Key name of meta information to be fetched

Returns:

New Key object containing the requested meta information

String org.libelektra.Key.getName () [inline]

Helper function to get key name (key part of 'key-value' pair)

Returns:

Key name as String

int org.libelektra.Key.getNameSize () [inline]

Helper function to get key name size.

Returns:

Length of key name

int org.libelektra.Key.getRef () [inline]

Gets the reference counter for this key.

Returns:

Reference counter as integer

short org.libelektra.Key.getShort () [inline]

Data type specific accessor function.

Returns:

Key value in short integer format

String org.libelektra.Key.getString () throws KeyTypeMismatch [inline]

Helper function to get representation of key value.

Returns:

Key value in String format

Exceptions:

KeyTypeMismatch

int org.libelektra.Key.getValueSize () [inline]

Helper function to get key value size/length.

Returns:

Length of key value

boolean org.libelektra.Key.isBelow (final Key other) [inline]

Helper function to check if key is sub-key of other key.

Parameters:

other Key that is used in check as parent key

Returns:

Boolean if this key is (non-direct) sub-key of other-key

boolean org.libelektra.Key.isBelowOrSame (final Key other) [inline]

Helper function to check if key is other key or sub-key of other key.

Parameters:

other Key that is used in check as parent key

Returns:

Boolean if this key is other key or (non-direct) sub-key of other-key

boolean org.libelektra.Key.isBinary () [inline]

Helper function to check if key is binary key.

Returns:

Boolean if this key is a binary key

boolean org.libelektra.Key.isDirectBelow (final Key other) [inline]

Helper function to check if key is direct sub-key of other key.

Parameters:

other Key that is used in check as parent key

Returns:

Boolean if this key is direct sub-key of other key ('child')

boolean org.libelektra.Key.isInactive () [inline]

Helper function to check if key is set to inactive.

Returns:

Boolean if this key is inactive

boolean org.libelektra.Key.isNull () [inline]

Helper function that does null comparison.

Returns:

Boolean if key is null

boolean org.libelektra.Key.isString () [inline]

Helper function to check if key is string key.

Returns:

Boolean if this key is a string key

java.util.Iterator<String> org.libelektra.Key.iterator () [inline]

Iterable interface function.

Returns:

Custom KeyNameIterator

int org.libelektra.Key.needsSync () [inline]

Helper function to check if synchronization is necessary.

Returns:

1 if needs sync, 0 if no change done and -1 in case of a null pointer

Key org.libelektra.Key.nextMeta () [inline]

Gets the next meta information for this key.

Returns:

new Key object containing the next meta information

int org.libelektra.Key.rel (final Key other) [inline]

Helper function to check for relation between keys.

Parameters:

other Other Key object that is used in relation check

Returns:

0 if other is equal to this; > 0 if other is sub-key of this key; < 0 otherwise or in case of an error

int org.libelektra.Key.rewindMeta () [inline]

Tries to rewind the meta information for this key.

Returns:

0 in case of no errors; 1 if key is not found; 2 if metakey is not found

void org.libelektra.Key.setBaseName (final String baseName) throws KeyInvalidName [inline]

Helper function to set key base name; will replace current base name with new base name.

Parameters:

baseName New key base name to use

Exceptions:

KeyInvalidName

void org.libelektra.Key.setBoolean (final boolean v) [inline]

Data type specific setter function.

Parameters:

v Boolean value to set

void org.libelektra.Key.setByte (final byte v) [inline]

Data type specific setter function.

Parameters:

v Byte value to set

void org.libelektra.Key.setDouble (final double v) [inline]

Data type specific setter function.

Parameters:

v Double value to set

void org.libelektra.Key.setError (final String text, final Object... args) [inline]

Helper function to set proper error meta for key.

Parameters:

text Reason for the error
args Custom arguments

void org.libelektra.Key.setFloat (final float v) [inline]

Data type specific setter function.

Parameters:

v Float value to set

void org.libelektra.Key.setInteger (final int v) [inline]

Data type specific setter function.

Parameters:

v Integer value to set

void org.libelektra.Key.setLong (final long v) [inline]

Data type specific setter function.

Parameters:

v Long integer value to set

int org.libelektra.Key.setMeta (final String metaName, final String newMetaString) [inline]

Setter for meta information.

Parameters:

metaName Key name of meta information to be set
newMetaString Meta value to be set

Returns:

-1 in case of an error, 0 if no meta with given name is available for the key and value > 0 representing the size of newMetaString if update successful

void org.libelektra.Key.setName (final String name) throws KeyInvalidName [inline]

Helper function to set key name.

Parameters:

name New key name to use

Exceptions:

KeyInvalidName

void org.libelektra.Key.setShort (final short v) [inline]

Data type specific setter function.

Parameters:

v Short integer value to set

int org.libelektra.Key.setString (final String newString) [inline]

Helper function to set new key value.

Parameters:

newString New key value to set

Returns:

value > 0 representing saved bytes (+null byte), -1 in case of an error (null key)

String org.libelektra.Key.toString () [inline]

Basic java function that represents object as String.

Returns:

Key name in String format

Author

Generated automatically by Doxygen for Elektra from the source code.

Mon Jan 15 2018 Version 0.8.20