Class WTPreferences
- All Implemented Interfaces:
Serializable
Features beyond the javax.prefs specification are available using this implementation, but typical preference operations should be invoked from the abstract Preferences class to insure compatibility with other Preferences implementation which may become available in the future.
The main additional feature of WTPreferences is the inclusion of contexts.
A context defines a grouping of preference entries. An instance of
WTPreference has a contextMask and an editContext attribute which define
the contexts used in reading and writing preference entries. contextMask
is actually an array of contexts which are searched in order for each
get request. The default contextMask is {USER_CONTEXT, DEFAULT_CONTEXT}
and the default editContext is the first element of the contextMask.
These default settings allow a user to "hide" a system-wide default.
If no entries are found within the contextMask's contexts, then the
programmatic default will be returned.
Supported API: true
Extendable: false
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetContext(String key) Deprecated.String[]Deprecated.Deprecated.booleanDeprecated.voidpreload()Deprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.voidsetContextMask(String[] a_ContextMask) Deprecated.voidsetEditContext(String a_EditContext) Deprecated.Methods inherited from class wt.prefs.Preferences
forClass, forPackage, fullName, getBoolean, getInt, init, name, node, nodeExists, parent, putBoolean
-
Field Details
-
DIVISION_CONTEXT
Deprecated.Constant for Division Context Preference Heirarchies
Supported API: true- See Also:
-
DIVISION_POLICY_CONTEXT
Deprecated.Constant for Policy driven preferences
Supported API: true- See Also:
-
USER_CONTEXT
Deprecated.
Supported API: true- See Also:
-
DEFAULT_CONTEXT
Deprecated.
Supported API: true- See Also:
-
CONTAINER_CONTEXT
Deprecated.Constant for Container Context Preference Heirarchies
Supported API: true- See Also:
-
CONTAINER_POLICY_CONTEXT
Deprecated.Constant for Policy driven preferences
Supported API: true- See Also:
-
-
Method Details
-
getContextMask
Deprecated.Gets the value of the attribute: contextMask; The list of contexts used in retrieving values from persistance storage. In retrieving values from storage, the context will be searched in order and return the first value found. The default context is {WTPreferences.USER, WTPreferences.DEFAULT}. This allows users to specify a preference value that "hide" values stored in the DEFAULT context. In the absence of a value in the USER context, the DEFAULT context will be returned. In the case that no contexts contain value, the programmatic default passed in the get calls will be returned.
Supported API: true- Returns:
- String[]
- See Also:
-
setContextMask
Deprecated.Sets the value of the attribute: contextMask; The list of contexts used in retrieving values from persistance storage. In retrieving values from storage, the context will be searched in order and return the first value found. The default context is {WTPreferences.USER, WTPreferences.DEFAULT}. This allows users to specify a preference value that "hide" values stored in the DEFAULT context. In the absence of a value in the USER context, the DEFAULT context will be returned. In the case that no contexts contain value, the programmatic default passed in the get calls will be returned.
Supported API: true- Parameters:
a_ContextMask-- See Also:
-
getEditContext
Deprecated.Gets the value of the attribute: editContext; Context which edit calls (ie put, remove) will be persisted against. Do not create context's beginning with '$', these are reserved for use by the system.
Supported API: true- Returns:
- String
- See Also:
-
setEditContext
Deprecated.Sets the value of the attribute: editContext; Context which edit calls (ie put, remove) will be persisted against. Do not create context's beginning with '$', these are reserved for use by the system.
Supported API: true- Parameters:
a_EditContext-- See Also:
-
preload
public void preload()Deprecated.Preloads all preference entries into the preference object. If preload is not set then preference entries will be retrieved from the server as necessary. Preload should probably be used if the application knows that it will be retrieving multiple entries.
Supported API: true -
preload
Deprecated.Preloads preference entries into the preference object for all keys specified in the keys argument. If preload is not set then preference entries will be retrieved from the server as necessary. Preload should probably be used if the application knows that it will be retrieving multiple entries.
Supported API: true- Parameters:
keys-
-
getContext
Deprecated.Returns the context which a call to a get operation would retrieve a value from. The context returned from this call may contain additional information beyond that of the editContext which created the element. Use the isContext method to check which context a value is retrieved from.
Supported API: true- Parameters:
key- key whose associated value's context is returned.- Returns:
- String
- See Also:
-
isContext
Deprecated.Returns true if the context used in retrieving the key's value is the same as the context passed in. This should be used in place of comparing a context with the value returned by getContext. getContext may have additional information appended to the context which is stripped by the comparison within this method.To check if the returned value is from the user's context:
boolean fromUser = pref.isContext("foo", WTPreferences.USER_CONTEXT);
Supported API: true- Parameters:
key- key whose associated value's context is being compared.context- context which is being compared with key's context. This may be any context, predefined context's are USER_CONTEXT and DEFAULT_CONTEXT.- Returns:
- boolean
- See Also:
-
putAll
Deprecated.Will put all the entries in the HashMap into the Preferences System.
Supported API: true- Parameters:
context- The edit contextmap- The map of key/value pairs- Throws:
WTException
-
putAll
Deprecated.Will put all the entries in the HashMap into the Preferences System. The edit context will be set to the user Edit Context
Supported API: true- Parameters:
map- The map of key/value pairs- Throws:
WTException
-
refresh
Deprecated.Ensures that future reads from this preference node for the key reflect any changes that have been committed to the persistent store.
Supported API: true- Parameters:
key-- See Also:
-
refresh
Deprecated.Ensures that future reads for the given keys of this preference node reflect any changes that have been committed to the persistent store.
Supported API: true- Parameters:
keys-- See Also:
-