|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.location.services.ServicePreferences
public abstract class ServicePreferences
This class is a superclass for service preferences. The subclasses have dedicated method to control the service specific preferences. This class provides a mechanism to control additional service provider specific preferences. The service providers must define a default language and a length unit.
A service provider may add additional preferences for the
services. This means that they must define new property keys
for the new preferences. In this case the property key name must
begin with a reverse domain name of the service provider. The new preferences
must also have a default value. The service provider is also
responsible for specifying the object types of these additional properties in
their own documentation. If the service provider do not support additional
preferences and therefore additional property keys, the
getAdditionalPropertyKeys
method
must return an empty array.
Any asynchronous method taking ServicePreferences
as a parameter
must read all the needed settings from the
ServicePreferences
before the method call finishes and the methods
must not modify given preferences in any way.
Method Summary | |
---|---|
abstract java.lang.String[] |
getAdditionalPropertyKeys()
Returns the list of the property keys for additional preferences that have been defined for a service provider. |
java.lang.String |
getLanguage()
Returns the language to be used in the service requests. |
java.lang.String |
getLengthUnit()
Returns the preferred length unit to be used in the service provider UIs. |
abstract java.lang.String[] |
getPropertyDisplayName(java.lang.String propertyKey,
boolean getValue,
java.lang.String languageTag)
Returns the presentation name for a given additional preference property. |
abstract java.lang.Object |
getPropertyValue(java.lang.String key)
Returns the value of the requested additional property as an Object . |
void |
setLanguage(java.lang.String languageTag)
This method is used to sets the language to be used in service requests. |
void |
setLengthUnit(java.lang.String lengthUnit)
Sets the length unit to be used in the service provider UIs. |
abstract void |
setPropertyValue(java.lang.String key,
java.lang.Object value)
Sets the property value for the specified key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setLanguage(java.lang.String languageTag)
This method is used to sets the language to be used in service requests.
The possible language tag values can be retrieved with
ProviderCapabilities.getPropertyValue
method using ProviderCapabilities.SUPPORTED_LANGUAGES
property
key. Passing null
or an empty String
as the
languageTag
sets the language to the default language of the
service provider.
languageTag
- the language to be used in service requests
java.lang.IllegalArgumentException
- if languageTag
is not one of the values retrieved with
ProviderCapabilities.getPropertyValue(SUPPORTED_LANGUAGES)
method or null
or an empty String
public java.lang.String getLanguage()
Returns the language to be used in the service requests. The
possible language tag values can be retrieved with
ProviderCapabilities.getPropertyValue
method using ProviderCapabilities.SUPPORTED_LANGUAGES
property
key. The method returns the default value set by the service provider
or value set with method setLanguage
.
public void setLengthUnit(java.lang.String lengthUnit)
Sets the length unit to be used in the service provider UIs. Possible length
unit values can be retrieved with
ProviderCapabilities.getPropertyValue(key)
method key values SUPPORTED_LENGTH_UNITS
. Passing null
or an empty String
as the lengthUnit
sets the
length unit to the default length unit of the service provider.
lengthUnit
- the length unit to be used in service provider UIs
java.lang.IllegalArgumentException
- if lengthUnit
is not one of the values retrieved with
ProviderCapabilities.getPropertyValue(SUPPORTED_LENGTH_UNITS)
method or null
or an empty String
public java.lang.String getLengthUnit()
Returns the preferred length unit to be used in the service provider UIs.
The possible length units can be retrieved with
ProviderCapabilities.getPropertyValue
method using ProviderCapabilities.SUPPORTED_LENGTH_UNITS
property
key. The method returns the default value set by the service provider
or value set with method setLengthUnit
.
public abstract java.lang.String[] getAdditionalPropertyKeys()
Returns the list of the property keys for additional preferences that
have been defined for a service provider. The actual property value can be
retrieved with getPropertyValue
method and set with setPropertyValue
method.
public abstract java.lang.Object getPropertyValue(java.lang.String key)
Returns the value of the requested additional property as an Object
.
The application must cast the returned value into right
object type defined in the property key description. If null
is passed in as the key a NullPointerException
is thrown.
The property keys are identified by the values of the String
retrieved with method
getAdditionalPropertyKeys
.
key
- the identifier of the property
null
if the key
is not defined
java.lang.NullPointerException
- if key
is null
public abstract void setPropertyValue(java.lang.String key, java.lang.Object value)
Sets the property value for the specified key. The additional key values
can be retrieved with
getAdditionalPropertyKeys
method. Passing null
as the property value, will reset the
property to the default value.
key
- the key identifier of the propertyvalue
- the value of the property, null
to reset the property
java.lang.IllegalArgumentException
- if key
is not one
of the additional keys or if value
is invalid for the
the specified key
java.lang.NullPointerException
- if key
is null
public abstract java.lang.String[] getPropertyDisplayName(java.lang.String propertyKey, boolean getValue, java.lang.String languageTag)
Returns the presentation name for a given additional preference
property. These presentation names can be used in the user interface. An
application may request either a property
key or a String
or String
array property value.
The presentation name for the property value is requested by setting the
getValue
parameter to true
. If the requested
property value is an array, the array must be returned in
the same order as with getPropertyValue
method. If getValue
is false
, the presentation name
of the additional preference property key is returned. If the value of
requested property key is not a String
or a String
array, or the propertyKey
or languageTag
is not
supported by the service provider, an IllegalArgumentException
is thrown.
The presentation names must be returned in the language
given in languageTag
parameter. The possible language tag
values can be retrieved with
ProviderCapabilities.getPropertyValue
method using SUPPORTED_LANGUAGES
property key.
The service provider implementations must support
presentation names for all additional preferences that it supports. This
means that if a service provider defines new provider specific preference,
the presentation name for it must also be supported.
The service provider must support presentation names for
String
property values for all preferences.
propertyKey
- the additional property key which presentation name is queriedgetValue
- true
if the property value is returned,
else false
languageTag
- the language in which the display name is requested
java.lang.IllegalArgumentException
- if getValue
is set to
true
and the value of the given propertyKey
is not a String
or a String
array
or if languageTag
or propertyKey
is not supported by the service provider
java.lang.NullPointerException
- if propertyKey
or
languageTag
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |