• R/O
  • SSH
  • HTTPS

figer: コミット


コミットメタ情報

リビジョン30 (tree)
日時2010-10-01 22:39:57
作者shinsuke

ログメッセージ

updated as java6.

変更サマリ

差分

--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveMap.java (revision 29)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveMap.java (revision 30)
@@ -15,16 +15,19 @@
1515 */
1616 package org.seasar.framework.util;
1717
18-import java.util.Iterator;
1918 import java.util.Map;
2019
2120 /**
2221 * キーで大文字小文字を気にしない {@link ArrayMap}です。
2322 *
23+ * @param <K>
24+ * キーの型
25+ * @param <V>
26+ * 値の型
27+ *
2428 * @author higa
25- *
2629 */
27-public class CaseInsensitiveMap extends ArrayMap {
30+public class CaseInsensitiveMap<K, V> extends ArrayMap<K, V> {
2831
2932 private static final long serialVersionUID = 1L;
3033
@@ -54,22 +57,21 @@
5457 return super.containsKey(convertKey(key));
5558 }
5659
57- public final Object get(Object key) {
60+ public final V get(Object key) {
5861 return super.get(convertKey(key));
5962 }
6063
61- public final Object put(Object key, Object value) {
64+ public final V put(K key, V value) {
6265 return super.put(convertKey(key), value);
6366 }
6467
65- public final void putAll(Map map) {
66- for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
67- Map.Entry entry = (Map.Entry) i.next();
68+ public final void putAll(Map<? extends K, ? extends V> map) {
69+ for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
6870 put(convertKey(entry.getKey()), entry.getValue());
6971 }
7072 }
7173
72- public final Object remove(Object key) {
74+ public final V remove(Object key) {
7375 return super.remove(convertKey(key));
7476 }
7577
@@ -77,8 +79,9 @@
7779 return super.containsKey(convertKey(key));
7880 }
7981
80- private static String convertKey(Object key) {
81- return ((String) key).toLowerCase();
82+ @SuppressWarnings("unchecked")
83+ private static <K> K convertKey(K key) {
84+ return (K) key.toString().toLowerCase();
8285 }
8386
8487 }
--- figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataSetImpl.java (revision 29)
+++ figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataSetImpl.java (revision 30)
@@ -29,7 +29,7 @@
2929 */
3030 public class DataSetImpl implements DataSet {
3131
32- private ArrayMap tables = new CaseInsensitiveMap();
32+ private ArrayMap<String, DataTable> tables = new CaseInsensitiveMap<String, DataTable>();
3333
3434 /**
3535 * {@link DataSetImpl}を作成します。
@@ -55,7 +55,7 @@
5555 * @see org.seasar.extension.dataset.DataSet#getTable(int)
5656 */
5757 public DataTable getTable(int index) {
58- return (DataTable) tables.get(index);
58+ return tables.getAt(index);
5959 }
6060
6161 /**
@@ -71,7 +71,7 @@
7171 public DataTable getTable(String tableName)
7272 throws TableNotFoundRuntimeException {
7373
74- DataTable table = (DataTable) tables.get(tableName);
74+ DataTable table = tables.get(tableName);
7575 if (table == null) {
7676 throw new TableNotFoundRuntimeException(tableName);
7777 }
@@ -104,7 +104,7 @@
104104 * @see org.seasar.extension.dataset.DataSet#removeTable(int)
105105 */
106106 public DataTable removeTable(int index) {
107- return (DataTable) tables.remove(index);
107+ return tables.removeAt(index);
108108 }
109109
110110 /**
@@ -111,7 +111,7 @@
111111 * @see org.seasar.extension.dataset.DataSet#removeTable(java.lang.String)
112112 */
113113 public DataTable removeTable(String tableName) {
114- DataTable table = (DataTable) tables.remove(tableName);
114+ DataTable table = tables.remove(tableName);
115115 if (table == null) {
116116 throw new TableNotFoundRuntimeException(tableName);
117117 }
@@ -119,10 +119,10 @@
119119 }
120120
121121 public String toString() {
122- StringBuffer buf = new StringBuffer(100);
122+ StringBuilder buf = new StringBuilder(100);
123123 for (int i = 0; i < getTableSize(); ++i) {
124124 buf.append(getTable(i));
125- buf.append("\n");
125+ buf.append('\n');
126126 }
127127 return buf.toString();
128128 }
旧リポジトリブラウザで表示