de.tkuhn.util.prefs
Interface MetaInfo

All Known Implementing Classes:
PrefsMetaInfo

public interface MetaInfo

This interface defines Meta Information about a Preferences node. It must always be seen in conjunction with the Preferences it describes.

Author:
Tilmann Kuhn

Field Summary
static java.lang.String KEY_ICONRES
          Store a reference to a Icon resource under this key
static java.lang.String KEY_LONGDESC
          Store a key for the value of a resource bundle containing long descriptions or the description itself under this key
static java.lang.String KEY_NAME
          Store a key for the value of a resource bundle containing the name of the preference/node or the name itself under this key
static java.lang.String KEY_SHORTDESC
          Store a key for the value of a resource bundle containing short descriptions or the description itself under this key
static java.lang.String KEY_TYPE
          Store the pref type under this key
static java.lang.String KEY_USEREDIT
          Store the fact if a user (not admin) may edit the pref under this key
static int TYPE_boolean
           
static int TYPE_byteArray
           
static int TYPE_double
           
static int TYPE_float
           
static int TYPE_int
           
static int TYPE_long
           
static int TYPE_string
           
static int TYPE_undefined
           
 
Method Summary
 java.lang.String getMappingInfo(java.lang.String key, java.lang.String infoKey, java.lang.String defaultInfo)
          Retrieve a piece of Information stored about the mapping identified by its key inside the node this MetaInfo describes mapped to the infoKey.
 java.lang.String getNodeInfo(java.lang.String infoKey, java.lang.String defaultInfo)
          Retrieve a piece of Information stored about the node described by this MetaInfo under the given key.
 int getType(java.lang.String key)
          Get the type of the value mapped with the given key.
 boolean isUserEditable(java.lang.String key)
          Check if the value of the mapping with the given key is editable by users or by admins only.
 void setMappingInfo(java.lang.String key, java.lang.String infoKey, java.lang.String info)
          Store a piece of Information about the mapping identified by its key inside the node described by this MetaInfo.
 void setNodeInfo(java.lang.String infoKey, java.lang.String info)
          Store a piece of Information about the node described by this MetaInfo under the given key.
 void setType(java.lang.String key, int type)
          Set the type of the value mapped with the given key.
 void setUserEditable(java.lang.String key, boolean editable)
          Set if the value of the mapping with the given key should be editable by users or by admins only.
 

Field Detail

TYPE_undefined

static final int TYPE_undefined
See Also:
Constant Field Values

TYPE_string

static final int TYPE_string
See Also:
Constant Field Values

TYPE_int

static final int TYPE_int
See Also:
Constant Field Values

TYPE_long

static final int TYPE_long
See Also:
Constant Field Values

TYPE_double

static final int TYPE_double
See Also:
Constant Field Values

TYPE_float

static final int TYPE_float
See Also:
Constant Field Values

TYPE_boolean

static final int TYPE_boolean
See Also:
Constant Field Values

TYPE_byteArray

static final int TYPE_byteArray
See Also:
Constant Field Values

KEY_ICONRES

static final java.lang.String KEY_ICONRES
Store a reference to a Icon resource under this key

See Also:
Constant Field Values

KEY_NAME

static final java.lang.String KEY_NAME
Store a key for the value of a resource bundle containing the name of the preference/node or the name itself under this key

See Also:
Constant Field Values

KEY_SHORTDESC

static final java.lang.String KEY_SHORTDESC
Store a key for the value of a resource bundle containing short descriptions or the description itself under this key

See Also:
Constant Field Values

KEY_LONGDESC

static final java.lang.String KEY_LONGDESC
Store a key for the value of a resource bundle containing long descriptions or the description itself under this key

See Also:
Constant Field Values

KEY_USEREDIT

static final java.lang.String KEY_USEREDIT
Store the fact if a user (not admin) may edit the pref under this key

See Also:
Constant Field Values

KEY_TYPE

static final java.lang.String KEY_TYPE
Store the pref type under this key

See Also:
Constant Field Values
Method Detail

getType

int getType(java.lang.String key)
Get the type of the value mapped with the given key. This operation returns TYPE_undefined if the type is not set of if the storage back-end is not reachable.

Parameters:
key - the key of the mapping
Returns:
the type of the mapping as int

setType

void setType(java.lang.String key,
             int type)
Set the type of the value mapped with the given key. It is the callers due to check if the contents of the mapping obey this type!

Parameters:
key - the key of the mapping
type - the new type of the mapping. Should be one of the predefined types.

isUserEditable

boolean isUserEditable(java.lang.String key)
Check if the value of the mapping with the given key is editable by users or by admins only. This operation returns false if the flag is not set or if the storage backend is not reachable.

Parameters:
key - the key of the mapping
Returns:
true if users may edit, false otherwise

setUserEditable

void setUserEditable(java.lang.String key,
                     boolean editable)
Set if the value of the mapping with the given key should be editable by users or by admins only.

Parameters:
key - the key of the mapping
editable - the new state: true: users may edit false: admins only

getNodeInfo

java.lang.String getNodeInfo(java.lang.String infoKey,
                             java.lang.String defaultInfo)
Retrieve a piece of Information stored about the node described by this MetaInfo under the given key. This operation returns default if the mapping is not set or if the storage back-end is not reachable.

Parameters:
infoKey - the key the data was mapped to
defaultInfo - the default to be returned on missing data
Returns:
the value of the mapping or the default

setNodeInfo

void setNodeInfo(java.lang.String infoKey,
                 java.lang.String info)
Store a piece of Information about the node described by this MetaInfo under the given key.

Parameters:
infoKey - the key to map the data with
info - the data to be mapped

getMappingInfo

java.lang.String getMappingInfo(java.lang.String key,
                                java.lang.String infoKey,
                                java.lang.String defaultInfo)
Retrieve a piece of Information stored about the mapping identified by its key inside the node this MetaInfo describes mapped to the infoKey. This operation returns default if the mapping is not set or if the storage back-end is not reachable.

Parameters:
key - the key of the mapping data was stored about
infoKey - the key the data was mapped to
defaultInfo - the default to be returned on missing data
Returns:
the value of the mapping or the default

setMappingInfo

void setMappingInfo(java.lang.String key,
                    java.lang.String infoKey,
                    java.lang.String info)
Store a piece of Information about the mapping identified by its key inside the node described by this MetaInfo. Map the data to the infoKey.

Parameters:
key - the key of the mapping to store data about
infoKey - key to map the data with
info - the data to be mapped


Copyright © Tilmann Kuhn