de.unikassel.android.sdcframework.preferences
Class TimeProviderPreferenceImpl

Package class diagram package TimeProviderPreferenceImpl
java.lang.Object
  extended by de.unikassel.android.sdcframework.preferences.TimeProviderPreferenceImpl
All Implemented Interfaces:
SinglePreference<TimeProviderConfiguration>, TimeProviderPreference

public class TimeProviderPreferenceImpl
extends Object
implements TimeProviderPreference

Implementation of the time provider preference.


Field Summary
static TimeProviderErrorStrategyDescription DEFAULT_ERR_STRATEGY
          The default for the error strategy.
static String DEFAULT_PROVIDERS
          The log level default value
private  SinglePreference<TimeProviderErrorStrategyDescription> errorStrategyPreference
          The preference for the error strategy
static String KEY_ERR_STRATEGY
          Android preference key for the error strategy.
static String KEY_PROVIDERS
          Android preference key for providers.
private static String PREFIX
          The key prefix.
static String SEPARATOR
          The separator between two provider entries
private  StringPreference timeProviderPreference
          The preference for the time providers
 
Constructor Summary
TimeProviderPreferenceImpl()
          Constructor
 
Method Summary
 TimeProviderConfiguration getConfiguration(SharedPreferences sharedPreferences)
          Getter for the current value in the shared preferences
 TimeProviderConfiguration getDefault()
          Getter for the default value
 SinglePreference<TimeProviderErrorStrategyDescription> getErrorStrategyPreference()
          Getter for the error strategy preference.
 String getKey()
          Getter for the preference key
 List<String> getProviderListFromEntry(String providerString)
          Method to convert a provider preference entry into a list of providers
 String getProvidersEntryFromList(List<String> providers)
          Method to convert a list of providers to a preference entry of concatenated provider addresses.
 StringPreference getProvidersPreference()
          Getter for the providers preference
 void setDefault(TimeProviderConfiguration defaultValue)
          Setter for the default value
 boolean testForKey(String key)
          Method to test for a preferences key support
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX

private static final String PREFIX
The key prefix.

See Also:
Constant Field Values

SEPARATOR

public static final String SEPARATOR
The separator between two provider entries

See Also:
Constant Field Values

KEY_PROVIDERS

public static final String KEY_PROVIDERS
Android preference key for providers.

See Also:
Constant Field Values

DEFAULT_PROVIDERS

public static final String DEFAULT_PROVIDERS
The log level default value

See Also:
Constant Field Values

KEY_ERR_STRATEGY

public static final String KEY_ERR_STRATEGY
Android preference key for the error strategy.

See Also:
Constant Field Values

DEFAULT_ERR_STRATEGY

public static final TimeProviderErrorStrategyDescription DEFAULT_ERR_STRATEGY
The default for the error strategy.


timeProviderPreference

private final StringPreference timeProviderPreference
The preference for the time providers


errorStrategyPreference

private final SinglePreference<TimeProviderErrorStrategyDescription> errorStrategyPreference
The preference for the error strategy

Constructor Detail

TimeProviderPreferenceImpl

public TimeProviderPreferenceImpl()
Constructor

Method Detail

getKey

public String getKey()
Description copied from interface: SinglePreference
Getter for the preference key

Specified by:
getKey in interface SinglePreference<TimeProviderConfiguration>
Returns:
the preference key

getConfiguration

public TimeProviderConfiguration getConfiguration(SharedPreferences sharedPreferences)
Description copied from interface: SinglePreference
Getter for the current value in the shared preferences

Specified by:
getConfiguration in interface SinglePreference<TimeProviderConfiguration>
Parameters:
sharedPreferences - the shared application preferences
Returns:
the current value

getDefault

public TimeProviderConfiguration getDefault()
Description copied from interface: SinglePreference
Getter for the default value

Specified by:
getDefault in interface SinglePreference<TimeProviderConfiguration>
Returns:
the default value

setDefault

public void setDefault(TimeProviderConfiguration defaultValue)
Description copied from interface: SinglePreference
Setter for the default value

Specified by:
setDefault in interface SinglePreference<TimeProviderConfiguration>
Parameters:
defaultValue - the default value to set

testForKey

public boolean testForKey(String key)
Description copied from interface: SinglePreference
Method to test for a preferences key support

Specified by:
testForKey in interface SinglePreference<TimeProviderConfiguration>
Parameters:
key - the key to test for
Returns:
true if this key is supported, false otherwise

getProvidersEntryFromList

public final String getProvidersEntryFromList(List<String> providers)
Description copied from interface: TimeProviderPreference
Method to convert a list of providers to a preference entry of concatenated provider addresses.

Specified by:
getProvidersEntryFromList in interface TimeProviderPreference
Parameters:
providers - the list of the providers
Returns:
the provider preference entry

getProviderListFromEntry

public final List<String> getProviderListFromEntry(String providerString)
Method to convert a provider preference entry into a list of providers

Parameters:
providerString - the string with the concatenated provider entries
Returns:
a list of the contained providers

getErrorStrategyPreference

public SinglePreference<TimeProviderErrorStrategyDescription> getErrorStrategyPreference()
Description copied from interface: TimeProviderPreference
Getter for the error strategy preference.

Specified by:
getErrorStrategyPreference in interface TimeProviderPreference
Returns:
the error strategy description preference

getProvidersPreference

public StringPreference getProvidersPreference()
Description copied from interface: TimeProviderPreference
Getter for the providers preference

Specified by:
getProvidersPreference in interface TimeProviderPreference
Returns:
the providers preference