本文整理汇总了Java中org.apache.commons.collections.map.ListOrderedMap类的典型用法代码示例。如果您正苦于以下问题:Java ListOrderedMap类的具体用法?Java ListOrderedMap怎么用?Java ListOrderedMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListOrderedMap类属于org.apache.commons.collections.map包,在下文中一共展示了ListOrderedMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParametersFor
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Returns the parameters for the given table.
*
* @param table The table
* @return The parameters
*/
public Map getParametersFor(Table table)
{
ListOrderedMap result = new ListOrderedMap();
Map globalParams = (Map)_parametersPerTable.get(null);
Map tableParams = (Map)_parametersPerTable.get(table.getQualifiedName());
if (globalParams != null)
{
result.putAll(globalParams);
}
if (tableParams != null)
{
result.putAll(tableParams);
}
return result;
}
示例2: sortListBeans
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* 根据给定的条件,把 list 中的 javabean 排序。
* 用到了 commons beanutils 和 commons.collections
*
* @param list 待排序的 list
* @param listOrderedMap 排序条件。
* 这是一个有序的 list ,排序条件按照加入到 list 的 bean 的属性(map 的 key)的先后顺序排序。
* listOrderedMap 的 key 为待排序的 bean 的属性名称,值为是否按该属性的正序排序,true 为正序,false 为逆序。
* 使用方法见本类的 testSortListBeans() 方法例子,使用时注意不要写错 bean 的属性名称。
* @param <T> list 中的 bean 类型
*/
public static <T> void sortListBeans(List<T> list, ListOrderedMap listOrderedMap) {
int num = listOrderedMap.size();
ArrayList sortFields = new ArrayList();
for (int i = 0; i < num; i++) {
// System.out.println("key =" + listOrderedMap.get(i) + " , value=" + listOrderedMap.getValue(i));
Comparator comp = ComparableComparator.getInstance();
comp = ComparatorUtils.nullLowComparator(comp); //允许null
if ((Boolean) listOrderedMap.getValue(i) == false)
comp = ComparatorUtils.reversedComparator(comp); //逆序
Comparator cmp = new BeanComparator((String) listOrderedMap.get(i), comp);
sortFields.add(cmp);
}
ComparatorChain multiSort = new ComparatorChain(sortFields);
Collections.sort(list, multiSort);
}
示例3: parseMethodParams
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
private static Map<String,Class<?>> parseMethodParams(String str) {
OrderedMap params = new ListOrderedMap();
if (str.contains("(") && str.contains(")")) {
String target = str.substring(str.indexOf("(") + 1, str.lastIndexOf(")"));
String[] nameAndTypes = target.split(",");
for (String nameAndType : nameAndTypes) {
String[] paramWrapper = nameAndType.split(":");
String name = paramWrapper[0];
String type = paramWrapper[1];
try {
params.put(name,Class.forName(type));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
return params;
}
示例4: main
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(String[] args) {
System.out.println(System.getProperty("os.arch"));
SpellChecker spellChecker = new SpellChecker("./dictionaries");
ListOrderedMap suggestion = spellChecker
.suggest("jestion de proget", "web");
List<String> keys = suggestion.keyList();
for (String key : keys) {
if (suggestion.get(key) != null) {
System.out.print(key + " : ");
List<String> keySugs = (List<String>) suggestion.get(key);
for (String sug : keySugs) {
System.out.print(sug + ", ");
}
System.out.println();
} else {
System.out.println(key);
}
}
}
示例5: getSuggestedSearchAsString
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private String getSuggestedSearchAsString() {
StringBuffer sb = new StringBuffer();
ListOrderedMap suggestedSearch = (ListOrderedMap) getModelObject();
for (String motOriginal : (Set<String>) suggestedSearch.keySet()) {
List<String> suggestedWords = (List<String>) suggestedSearch.get(motOriginal);
if (suggestedWords == null || suggestedWords.isEmpty()) {
sb.append(motOriginal);
} else {
// First word
sb.append(suggestedWords.get(0));
}
sb.append(" ");
}
if (sb.length() > 0) {
// Supprimer le dernier espace
sb.replace(sb.length() - 1, sb.length(), "");
}
return sb.toString();
}
示例6: hasManySuggestions
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean hasManySuggestions() {
boolean manySuggestions = false;
boolean firstSuggestion = true;
ListOrderedMap suggestedSearch = (ListOrderedMap) getModelObject();
for (String motOriginal : (Set<String>) suggestedSearch.keySet()) {
List<String> suggestedWords = (List<String>) suggestedSearch.get(motOriginal);
if (suggestedWords != null && suggestedWords.size() > 1) {
if (firstSuggestion) {
firstSuggestion = false;
} else {
manySuggestions = true;
break;
}
}
}
return manySuggestions;
}
示例7: testEgovMapTest
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
@Test
public void testEgovMapTest() throws Exception {
Map<String, Object> map = makeMap();
// insert
mapTypeMapper.insertDept("insertDeptUsingMap", map);
// select
Map<String, Object> resultMap =
mapTypeMapper.selectDept("selectDeptUsingEgovMap", map);
// check
assertNotNull(resultMap);
// resultType을 EgovMap으로 명시하면
// key 를 camel case 로 변환하여 전달해줌
// EgovMap 은 ListOrderedMap 을 extends 하고 있음
assertTrue(resultMap instanceof ListOrderedMap);
assertEquals(map.get("deptNo"), resultMap.get("deptNo"));
assertEquals(map.get("deptName"), resultMap.get("deptName"));
assertEquals(map.get("loc"), resultMap.get("loc"));
}
示例8: testEgovMapTest
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
@Test
public void testEgovMapTest() throws Exception {
Map<String, Object> map = makeMap();
// insert
mapTypeDAO.insertDept("insertDeptUsingMap", map);
// select
Map<String, Object> resultMap =
mapTypeDAO.selectDept("selectDeptUsingEgovMap", map);
// check
assertNotNull(resultMap);
// EgovMap 으로 resultClass 를 명시하면
// key 를 camel case 로 변환하여 전달해줌
// EgovMap 은 ListOrderedMap 을 extends 하고 있음
assertTrue(resultMap instanceof ListOrderedMap);
assertEquals(map.get("deptNo"), resultMap.get("deptNo"));
assertEquals(map.get("deptName"), resultMap.get("deptName"));
assertEquals(map.get("loc"), resultMap.get("loc"));
}
示例9: getParametersFor
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Returns the parameters for the given table.
*
* @param table The table
* @return The parameters
*/
public Map getParametersFor(Table table)
{
ListOrderedMap result = new ListOrderedMap();
Map globalParams = (Map)_parametersPerTable.get(null);
Map tableParams = (Map)_parametersPerTable.get(table);
if (globalParams != null)
{
result.putAll(globalParams);
}
if (tableParams != null)
{
result.putAll(tableParams);
}
return result;
}
示例10: readForeignKeys
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Retrieves the foreign keys of the indicated table.
*
* @param metaData The database meta data
* @param tableName The name of the table from which to retrieve FK information
* @return The foreign keys
*/
protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
{
Map fks = new ListOrderedMap();
ResultSet fkData = null;
try
{
fkData = metaData.getForeignKeys(tableName);
while (fkData.next())
{
Map values = readColumns(fkData, getColumnsForFK());
readForeignKey(metaData, values, fks);
}
}
finally
{
if (fkData != null)
{
fkData.close();
}
}
return fks.values();
}
示例11: readIndices
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Determines the indices for the indicated table.
*
* @param metaData The database meta data
* @param tableName The name of the table
* @return The list of indices
*/
protected Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
{
Map indices = new ListOrderedMap();
ResultSet indexData = null;
try
{
indexData = metaData.getIndices(tableName, false, false);
while (indexData.next())
{
Map values = readColumns(indexData, getColumnsForIndex());
readIndex(metaData, values, indices);
}
}
finally
{
if (indexData != null)
{
indexData.close();
}
}
return indices.values();
}
示例12: popTransactionStartStamp
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Remove the stamp from stack (when resuming)
*/
private static void popTransactionStartStamp() {
ListOrderedMap map = (ListOrderedMap) suspendedTxStartStamps.get();
if (map.size() > 0) {
transactionStartStamp.set((Timestamp) map.remove(map.lastKey()));
} else {
Debug.logError("Error in transaction handling - no saved start stamp found - using NOW.", module);
transactionStartStamp.set(UtilDateTime.nowTimestamp());
}
}
示例13: readIndices
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
{
// Jaybird is not able to read indices when delimited identifiers are turned on,
// so we gather the data manually using Firebird's system tables
final String query =
"SELECT a.RDB$INDEX_NAME INDEX_NAME, b.RDB$RELATION_NAME TABLE_NAME, b.RDB$UNIQUE_FLAG NON_UNIQUE, " +
"a.RDB$FIELD_POSITION ORDINAL_POSITION, a.RDB$FIELD_NAME COLUMN_NAME, 3 INDEX_TYPE " +
"FROM RDB$INDEX_SEGMENTS a, RDB$INDICES b WHERE a.RDB$INDEX_NAME=b.RDB$INDEX_NAME AND b.RDB$RELATION_NAME = ?";
Map indices = new ListOrderedMap();
PreparedStatement stmt = null;
try
{
stmt = getConnection().prepareStatement(query);
stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName.toUpperCase());
ResultSet indexData = stmt.executeQuery();
while (indexData.next())
{
Map values = readColumns(indexData, getColumnsForIndex());
// we have to reverse the meaning of the unique flag; also, null means false
values.put("NON_UNIQUE", (values.get("NON_UNIQUE") == null) || Boolean.FALSE.equals(values.get("NON_UNIQUE")) ? Boolean.TRUE : Boolean.FALSE);
// and trim the names
values.put("INDEX_NAME", ((String)values.get("INDEX_NAME")).trim());
values.put("TABLE_NAME", ((String)values.get("TABLE_NAME")).trim());
values.put("COLUMN_NAME", ((String)values.get("COLUMN_NAME")).trim());
readIndex(metaData, values, indices);
}
}
finally
{
closeStatement(stmt);
}
return indices.values();
}
示例14: readForeignKeys
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Retrieves the foreign keys of the indicated table.
*
* @param metaData The database meta data
* @param tableName The name of the table from which to retrieve FK information
* @return The foreign keys
*/
protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
{
Map fks = new ListOrderedMap();
ResultSet fkData = null;
try
{
// GemStone changes BEGIN
//fkData = metaData.getForeignKeys(metaData.escapeForSearch(tableName));
//The underlying DatabaseMetaData.getImportedKeys does not take the string pattern,
//so do not need escape the _, see ticket 44911
fkData = metaData.getForeignKeys(tableName);
// GemStone changes BEGIN
while (fkData.next())
{
Map values = readColumns(fkData, getColumnsForFK());
readForeignKey(metaData, values, fks);
}
}
finally
{
closeResultSet(fkData);
}
return fks.values();
}
示例15: readIndices
import org.apache.commons.collections.map.ListOrderedMap; //导入依赖的package包/类
/**
* Determines the indices for the indicated table.
*
* @param metaData The database meta data
* @param tableName The name of the table
* @return The list of indices
*/
protected Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException
{
Map indices = new ListOrderedMap();
ResultSet indexData = null;
try
{
// GemStone changes BEGIN
//indexData = metaData.getIndices(metaData.escapeForSearch(tableName), false, false);
//The underlying DatabaseMetaData.getIndexInfo does not take the string pattern,
//so do not need escape the _, see ticket 44911
indexData = metaData.getIndices(tableName, false, false);
// GemStone changes BEGIN
while (indexData.next())
{
Map values = readColumns(indexData, getColumnsForIndex());
readIndex(metaData, values, indices);
}
}
finally
{
closeResultSet(indexData);
}
return indices.values();
}