public class BaseListData extends Object implements ListData
| Modifier and Type | Field and Description |
|---|---|
static int |
ORDER_BY_FILE
Sort the list according to the order they appear inside the filename (don't sort)
|
static int |
ORDER_BY_ID
Sort the list according to the id (key) values, which can be integers
|
static int |
ORDER_BY_STRING_ID
Sort the list according to the id (key) values, which can be strings
|
static int |
ORDER_BY_VALUE
Sort the list according to item values, which are strings
|
| Constructor and Description |
|---|
BaseListData(String listname)
Creates a new BaseListData, looking for files inside the default directory "/lists",
and using the default sort order ORDER_BY_VALUE.
|
BaseListData(String listname,
int ordertype)
Creates a new BaseListData, looking for files inside the default directory "/lists".
|
BaseListData(String listname,
int ordertype,
String listDir)
Creates a new BaseListData
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
The name of this list, for example "genders"
|
String |
getValue(int id)
Returns the string value of the list data item with the given id with the default locale.
|
String |
getValue(int id,
Locale loc)
Returns the string value of the list data item with the given id in the given locale.
|
String |
getValue(String id)
Returns the string value for the list data item with the default locale.
|
String |
getValue(String id,
Locale loc)
Given an id and a locale return the list item value.
|
List<ListItem> |
getValues()
Returns a list of ListItem for the default locale.
|
List<ListItem> |
getValues(Locale loc)
Return a list of ListItem objects so you can print
the whole list for this locale.
|
int |
size()
The size of the list, for example a "genders" list should have 2 items.
|
protected void |
sort(List<ListItem> list,
int ordertype)
Sort the list acording to the order type.
|
public static final int ORDER_BY_ID
public static final int ORDER_BY_STRING_ID
public static final int ORDER_BY_VALUE
public static final int ORDER_BY_FILE
public BaseListData(String listname, int ordertype, String listDir) throws IOException
listname - The name of the listordertype - How this list should be sortedlistDir - The directory where to look for list files.IOExceptionpublic BaseListData(String listname, int ordertype) throws IOException
listname - The name of the listordertype - How this list should be sorted.IOExceptionpublic BaseListData(String listname) throws IOException
listname - The name of the listIOExceptionpublic String getName()
public int size()
public List<ListItem> getValues(Locale loc)
public List<ListItem> getValues()
ListDatapublic String getValue(String id, Locale loc)
public String getValue(String id)
ListDatapublic String getValue(int id)
ListDatapublic String getValue(int id, Locale loc)
ListDataCopyright © 2015. All Rights Reserved.