?? dictionarypropertyeditor.java
字號:
/*
* @作者:Hades , 創建日期:2006-12-25
*
* 汕頭大學03計算機本科
*
*/
package edu.stu.cn.segment.spring.ioc;
import java.beans.PropertyEditorSupport;
import edu.stu.cn.segment.matching.dictionary.DictionaryImpl;
import edu.stu.cn.segment.matching.util.DictionaryUtil;
/**
* @author Hades Guan 將字符串描述轉換為相應字典類型
*/
public class DictionaryPropertyEditor<T extends DictionaryImpl> extends
PropertyEditorSupport
{
@SuppressWarnings("unused")
private Class<T> classType = null;
/**
* 默認構造函數
*
* @param classType
* 指定所使用泛型的Class類型
*/
public DictionaryPropertyEditor(Class<T> classType)
{
this.classType = classType;
}
/*
* (非 Javadoc)
*
* @see java.beans.PropertyEditorSupport#setAsText(java.lang.String)
*/
@Override
public void setAsText(String text) throws IllegalArgumentException
{
// 初始化字典工具
DictionaryUtil<T> tool = new DictionaryUtil<T>();
// 根據指定的文件路徑初始化字典實例
T dic = tool.readDictionary(text);
// 設置訪問值
this.setValue(dic);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -