Jacally
Java原生態(tài)
BlogJava
首頁
新隨筆
新文章
聯(lián)系
聚合
管理
posts - 28, comments - 13, trackbacks - 0
利用java.util.Collections.sort方法排序
利用java.util.Collections.sort方法排序
//
所有選項(xiàng)集合
List lsDefineOptions
=
new
ArrayList();
for
(
int
j
=
0
;j
<
lsOptions.size();j
++
)
{
Element option
=
(Element) lsOptions.get(j);
String label
=
option.getAttributeValue(
"
label
"
);
String index
=
option.getAttributeValue(
"
index
"
);
String flowstate
=
option.getAttributeValue(
"
flowstate
"
);
String querySql
=
option.getChildText(
"
query-sql
"
);
//
操作項(xiàng)對象
SearchOptionDefine defineOption
=
new
SearchOptionDefine();
defineOption.setLabel(label);
if
(StringUtils.isNotBlank(index))
{
defineOption.setIndex(Integer.parseInt(index));
}
if
(StringUtils.isNotBlank(flowstate))
{
defineOption.setFlowstate(Integer.parseInt(flowstate));
}
defineOption.setQuerySql(querySql);
Log.debug(
"
querySql:
"
+
querySql);
lsDefineOptions.add(defineOption);
}
//
所有選項(xiàng)集合的排序
java.util.Collections.sort(lsDefineOptions);
操作項(xiàng)對象
SearchOptionDefine 必須實(shí)現(xiàn)Comparable接口
package
com.mip.core.objects;
import
java.io.Serializable;
/** */
/**
* <p>
* 主題查詢對象
* </p>
*
@author
Libin
* @date Mar 29, 2007
*
@version
4.0
*
*
@see
AnotherClass
*/
public
class
SearchOptionDefine
implements
Serializable,Comparable
{
/** */
/**
*
*/
private
static
final
long
serialVersionUID
=
3256440313546683697L
;
/** */
/**
A int variable 所有狀態(tài)標(biāo)志
*/
public
static
final
int
ALL_STATE
=
999
;
/** */
/**
* Constructs a SearchDefine
*/
public
SearchOptionDefine()
{
index
=
0
;
flowstate
=
ALL_STATE;
}
/** */
/**
* 主題查詢的每一項(xiàng)定義:
* label:對應(yīng)下拉框顯示的中文名稱
* index:排序序號
* flowstate:對應(yīng)流程狀態(tài),結(jié)合流程狀態(tài)來確定是否顯示當(dāng)前選項(xiàng)
* query_sql:原生SQL語句,主題查詢的條件
*/
private
String label;
private
Integer index;
private
Integer flowstate;
private
String querySql;
public
Integer getFlowstate()
{
return
flowstate;
}
public
void
setFlowstate(Integer flowstate)
{
this
.flowstate
=
flowstate;
}
public
Integer getIndex()
{
return
index;
}
public
void
setIndex(Integer index)
{
this
.index
=
index;
}
public
String getLabel()
{
return
label;
}
public
void
setLabel(String label)
{
this
.label
=
label;
}
public
String getQuerySql()
{
return
querySql;
}
public
void
setQuerySql(String query_sql)
{
this
.querySql
=
query_sql;
}
public
int
compareTo(Integer arg0)
{
return
index.compareTo(arg0);
}
public
int
compareTo(Object obj)
{
//
TODO Auto-generated method stub
return
(
this
.getIndex()
-
((SearchOptionDefine)obj).getIndex());
}
}
posted on 2007-03-29 13:15
Lib
閱讀(11321)
評論(1)
編輯
收藏
所屬分類:
Java
FeedBack:
#
re: 利用java.util.Collections.sort方法排序
2008-07-04 10:40 |
汽車
沒寫全呀..
回復(fù)
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
[導(dǎo)入]WebService開發(fā)筆記 2 -- VS 2005 訪問WebServcie更簡單
WebService開發(fā)筆記 1 -- 利用cxf開發(fā)WebService竟然如此簡單
[導(dǎo)入]CAS 單點(diǎn)登錄安裝筆記4 -- asp.net client端的設(shè)置
[導(dǎo)入]CAS 單點(diǎn)登錄安裝筆記3 -- 與acegi集成
[導(dǎo)入]CAS 單點(diǎn)登錄安裝筆記2 -- 配置CAS,訪問自己的用戶表
[導(dǎo)入]CAS 單點(diǎn)登錄安裝筆記1 -- 基本設(shè)置與數(shù)字證書的安裝
Eclipse 插件集合
利用java.util.Collections.sort方法排序
permgen space報(bào)錯(cuò)
JSTL語言詳解(摘抄)
Copyright ©2025 Lib Powered by:
博客園
模板提供:
滬江博客
<
2008年7月
>
日
一
二
三
四
五
六
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
我的JavaEye博客
http://lib.javaeye.com
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆分類
Java
文章分類
DataBase(3)
Flash(1)
Java(16)
開源框架(5)
服務(wù)配置(7)
網(wǎng)頁特效(7)
項(xiàng)目管理(1)
FLASH
JAVA夢想
黑羽翔天 § Kingda's Weblog
Java
搜索
最新評論
1.?re: WebService開發(fā)筆記 1 -- 利用cxf開發(fā)WebService竟然如此簡單
sdasd
--sd
2.?re: WebService開發(fā)筆記 1 -- 利用cxf開發(fā)WebService竟然如此簡單
公司的分公司的
--鵝鵝鵝
3.?re: WebService開發(fā)筆記 1 -- 利用cxf開發(fā)WebService竟然如此簡單
不錯(cuò)。,謝謝了
--wanxkl
4.?re: permgen space報(bào)錯(cuò)
垃圾 都說錯(cuò)了
--啊啊啊
5.?re: WebService開發(fā)筆記 1 -- 利用cxf開發(fā)WebService竟然如此簡單
最近項(xiàng)目用到CXF做開發(fā),學(xué)習(xí)下,謝謝
--靚女購物街
閱讀排行榜
1.?WebService開發(fā)筆記 3 -- 增加WebService訪問的安全性(4123)
評論排行榜
1.?WebService開發(fā)筆記 3 -- 增加WebService訪問的安全性(2)
主站蜘蛛池模板:
呼和浩特市
|
随州市
|
宁夏
|
孝昌县
|
敦化市
|
固镇县
|
萍乡市
|
盈江县
|
昔阳县
|
密山市
|
鹿邑县
|
宁远县
|
渭南市
|
潮安县
|
鹤壁市
|
莱芜市
|
含山县
|
宜章县
|
威海市
|
读书
|
台中县
|
宜君县
|
普陀区
|
买车
|
南澳县
|
苏尼特右旗
|
沭阳县
|
民勤县
|
无为县
|
礼泉县
|
南和县
|
周口市
|
华容县
|
印江
|
靖江市
|
新化县
|
老河口市
|
平利县
|
焉耆
|
宜丰县
|
顺昌县
|