public abstract class Preference extends Object
The preference names are treated as case-insensitive. The preference names shall be considered equal at least when the method java.lang.String.equalsIgnoreCase() returns true for the strings when the locale "EN.UK" is used. Depending on the locale used in the implementation, implementations are allowed to consider equal also other upper and lower case character pairs in addition to those defined by the "EN.UK" locale.
The standardized preference names in the present document shall only use such letters where the upper and lower case characters are recognized by the "EN.UK" locale.
| Modifier | Constructor and Description |
|---|---|
protected |
Preference()
This protected constructor is only present to enable sub-classes of
this one to be defined by the platform.
|
|
Preference(String name,
String value)
Creates a new preference with the specified name and the specified
value.
|
|
Preference(String name,
String[] value)
Creates a new preference with the specified name and the specified
value set.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int position,
String value)
Adds a new value for this preference.
|
void |
add(String value)
Adds a new value for this preference.
|
void |
add(String[] values)
Adds several new values for this preferences.
|
String[] |
getFavourites()
Returns the list of favourite values for this preference.
|
String |
getMostFavourite()
Returns the most favourite value for this preference, that is, the
first element of the list.
|
String |
getName()
Returns the name of the preference.
|
int |
getPosition(String value)
Returns the position in the list of the specified value.
|
boolean |
hasValue()
Tests if this preference has at least one value set.
|
void |
remove(String value)
Removes the specified value from the list of favourites.
|
void |
removeAll()
Removes all the values of a preference
|
void |
setMostFavourite(String value)
Sets the most favourite value for this preference.
|
String |
toString()
Convert name and favourites to a String.
|
protected Preference()
public Preference(String name, String value)
name - a String object representing the name of the preference.value - a String object representing the value of the preference.public Preference(String name, String[] value)
name - a String object representing the name of the preference.value - an array of String objects representing the set of values
for this preference ordered from the most favourite to the least favourite.public void add(String value)
value - a String object representing the new value.public void add(String[] values)
values - an array of strings representing the values to addpublic void add(int position,
String value)
position - an int representing the position in the list counting from zero.value - a String representing the new value to insert.public String[] getFavourites()
public String getMostFavourite()
public String getName()
public int getPosition(String value)
value - a String representing the value to look for.public boolean hasValue()
public void remove(String value)
value - a String representing the value to remove.public void removeAll()
public void setMostFavourite(String value)
value - the most favourite valueCopyright © 2012 code4tv.com. All Rights Reserved.