• R/O
  • SSH
  • HTTPS

figer: Commit


Commit MetaInfo

Revision31 (tree)
Time2010-10-04 06:33:41
Authorshinsuke

Log Message

updated to java6-style. (still working..)

Change Summary

Incremental Difference

--- figer-s2-container/trunk/s2-framework/src/test/java/org/seasar/framework/util/ArrayUtilTest.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/test/java/org/seasar/framework/util/ArrayUtilTest.java (revision 31)
@@ -130,7 +130,7 @@
130130 *
131131 */
132132 public void testIsEmpty() {
133- assertTrue(ArrayUtil.isEmpty(null));
133+ assertTrue(ArrayUtil.isEmpty((Object[]) null));
134134 assertTrue(ArrayUtil.isEmpty(new Object[] {}));
135135 assertFalse(ArrayUtil.isEmpty(new Object[] { "" }));
136136 assertFalse(ArrayUtil.isEmpty(new Object[] { "aaa" }));
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BinaryConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BinaryConversionUtil.java (revision 31)
@@ -21,7 +21,8 @@
2121 * @author higa
2222 *
2323 */
24-public class BinaryConversionUtil {
24+public class BinaryConversionUtil extends
25+ org.seasar.util.convert.BinaryConversionUtil {
2526
2627 /**
2728 * インスタンスを構築します。
@@ -29,22 +30,4 @@
2930 protected BinaryConversionUtil() {
3031 }
3132
32- /**
33- * byteの配列に変換します。
34- *
35- * @param o
36- * @return byteの配列
37- */
38- public static byte[] toBinary(Object o) {
39- if (o instanceof byte[]) {
40- return (byte[]) o;
41- } else if (o == null) {
42- return null;
43- } else {
44- if (o instanceof String) {
45- return ((String) o).getBytes();
46- }
47- throw new IllegalArgumentException(o.getClass().toString());
48- }
49- }
5033 }
\ No newline at end of file
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveSet.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveSet.java (revision 31)
@@ -16,10 +16,7 @@
1616 package org.seasar.framework.util;
1717
1818 import java.io.Serializable;
19-import java.util.AbstractSet;
2019 import java.util.Collection;
21-import java.util.Iterator;
22-import java.util.Map;
2320 import java.util.Set;
2421
2522 /**
@@ -28,20 +25,17 @@
2825 * @author higa
2926 *
3027 */
31-public class CaseInsensitiveSet extends AbstractSet implements Set,
28+public class CaseInsensitiveSet extends
29+ org.seasar.util.collection.CaseInsensitiveSet implements Set<String>,
3230 Serializable {
3331
34- static final long serialVersionUID = 0L;
32+ private static final long serialVersionUID = 1L;
3533
36- private transient Map map;
37-
38- private static final Object PRESENT = new Object();
39-
4034 /**
4135 * {@link CaseInsensitiveSet}を作成します。
4236 */
4337 public CaseInsensitiveSet() {
44- map = new CaseInsensitiveMap();
38+ super();
4539 }
4640
4741 /**
@@ -49,9 +43,8 @@
4943 *
5044 * @param c
5145 */
52- public CaseInsensitiveSet(Collection c) {
53- map = new CaseInsensitiveMap(Math.max((int) (c.size() / .75f) + 1, 16));
54- addAll(c);
46+ public CaseInsensitiveSet(Collection<String> c) {
47+ super(c);
5548 }
5649
5750 /**
@@ -60,34 +53,6 @@
6053 * @param initialCapacity
6154 */
6255 public CaseInsensitiveSet(int initialCapacity) {
63- map = new CaseInsensitiveMap(initialCapacity);
56+ super(initialCapacity);
6457 }
65-
66- public Iterator iterator() {
67- return map.keySet().iterator();
68- }
69-
70- public int size() {
71- return map.size();
72- }
73-
74- public boolean isEmpty() {
75- return map.isEmpty();
76- }
77-
78- public boolean contains(Object o) {
79- return map.containsKey(o);
80- }
81-
82- public boolean add(Object o) {
83- return map.put(o, PRESENT) == null;
84- }
85-
86- public boolean remove(Object o) {
87- return map.remove(o) == PRESENT;
88- }
89-
90- public void clear() {
91- map.clear();
92- }
9358 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ArrayUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ArrayUtil.java (revision 31)
@@ -17,7 +17,6 @@
1717
1818 import java.lang.reflect.Array;
1919 import java.util.Arrays;
20-import java.util.List;
2120
2221 /**
2322 * 配列に対するユーティリティクラスです。
@@ -25,7 +24,7 @@
2524 * @author higa
2625 *
2726 */
28-public class ArrayUtil {
27+public class ArrayUtil extends org.seasar.util.collection.ArrayUtil {
2928
3029 /**
3130 * インスタンスを構築します。
@@ -34,116 +33,6 @@
3433 }
3534
3635 /**
37- * 配列にオブジェクトを追加します。
38- *
39- * @param array
40- * @param obj
41- * @return オブジェクトが追加された結果の配列
42- */
43- public static Object[] add(Object[] array, Object obj) {
44- return org.seasar.util.collection.ArrayUtil.add(array, obj);
45- }
46-
47- /**
48- * intの配列にintを追加します。
49- *
50- * @param array
51- * @param value
52- * @return オブジェクトが追加された結果の配列
53- */
54- public static int[] add(int[] array, int value) {
55- return org.seasar.util.collection.ArrayUtil.add(array, value);
56- }
57-
58- /**
59- * 配列に配列を追加します。
60- *
61- * @param a
62- * @param b
63- * @return 配列が追加された結果の配列
64- */
65- public static Object[] add(final Object[] a, final Object[] b) {
66- return org.seasar.util.collection.ArrayUtil.addAll(a, b);
67- }
68-
69- /**
70- * 配列中のオブジェクトのindexを返します。
71- *
72- * @param array
73- * @param obj
74- * @return 配列中のオブジェクトのindex
75- */
76- public static int indexOf(Object[] array, Object obj) {
77- return org.seasar.util.collection.ArrayUtil.indexOf(array, obj);
78- }
79-
80- /**
81- * 配列中のcharのindexを返します。
82- *
83- * @param array
84- * @param ch
85- * @return 配列中のcharのindex
86- */
87- public static int indexOf(char[] array, char ch) {
88- return org.seasar.util.collection.ArrayUtil.indexOf(array, ch);
89- }
90-
91- /**
92- * 配列中から対象のオブジェクトを削除します。
93- *
94- * @param array
95- * @param obj
96- * @return 削除後の配列
97- */
98- public static Object[] remove(Object[] array, Object obj) {
99- return org.seasar.util.collection.ArrayUtil.remove(array, obj);
100- }
101-
102- /**
103- * 配列が空かどうかを返します。
104- *
105- * @param arrays
106- * @return 配列が空かどうか
107- */
108- public static boolean isEmpty(Object[] arrays) {
109- return org.seasar.util.collection.ArrayUtil.isEmpty(arrays);
110- }
111-
112- /**
113- * 配列にオブジェクトが含まれているかどうかを返します。
114- *
115- * @param array
116- * @param obj
117- * @return 配列にオブジェクトが含まれているかどうか
118- */
119- public static boolean contains(Object[] array, Object obj) {
120- return org.seasar.util.collection.ArrayUtil.contains(array, obj);
121- }
122-
123- /**
124- * 配列にcharが含まれているかどうかを返します。
125- *
126- * @param array
127- * @param ch
128- * @return 配列にcharが含まれているかどうか
129- */
130- public static boolean contains(char[] array, char ch) {
131- return org.seasar.util.collection.ArrayUtil.contains(array, ch);
132- }
133-
134- /**
135- * 順番は無視して2つの配列が等しいかどうかを返します。
136- *
137- * @param array1
138- * @param array2
139- * @return 順番は無視して2つの配列が等しいかどうか
140- */
141- public static boolean equalsIgnoreSequence(Object[] array1, Object[] array2) {
142- return org.seasar.util.collection.ArrayUtil.equalsIgnoreSequence(
143- array1, array2);
144- }
145-
146- /**
14736 * 配列を文字列に変換します。
14837 *
14938 * @param array
@@ -191,26 +80,4 @@
19180 Array.set(array, index, value);
19281 }
19382
194- /**
195- * 配列をオブジェクトの配列に変換します。
196- *
197- * @param obj
198- * @return オブジェクトの配列
199- */
200- public static Object[] toObjectArray(Object obj) {
201- return org.seasar.util.collection.ArrayUtil.toObjectArray(obj);
202- }
203-
204- /**
205- * 配列をリストに変換します。
206- *
207- * @param <T>
208- * 型
209- * @param obj
210- * 配列
211- * @return リスト
212- */
213- public static <T> List<T> toList(Object obj) {
214- return org.seasar.util.collection.ArrayUtil.toList(obj);
215- }
21683 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BigDecimalConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BigDecimalConversionUtil.java (revision 31)
@@ -16,7 +16,6 @@
1616 package org.seasar.framework.util;
1717
1818 import java.math.BigDecimal;
19-import java.text.SimpleDateFormat;
2019
2120 /**
2221 * {@link BigDecimal}用の変換ユーティリティです。
@@ -24,114 +23,13 @@
2423 * @author higa
2524 *
2625 */
27-public class BigDecimalConversionUtil {
26+public class BigDecimalConversionUtil extends
27+ org.seasar.util.convert.BigDecimalConversionUtil {
2828
2929 /**
30- * Tiger用のNormalizerのクラス名です。
31- */
32- protected static final String TIGER_NORMALIZER_CLASS_NAME = "org.seasar.framework.util.TigerBigDecimalConversion";
33-
34- /**
35- * デフォルトのNormalizerです。
36- */
37- protected static BigDecimalNormalizer normalizer = new DefaultNormalizer();
38- static {
39- try {
40- final Class clazz = Class.forName(TIGER_NORMALIZER_CLASS_NAME);
41- normalizer = (BigDecimalNormalizer) clazz.newInstance();
42- } catch (Exception ignore) {
43- }
44- }
45-
46- /**
4730 * インスタンスを構築します。
4831 */
4932 protected BigDecimalConversionUtil() {
5033 }
5134
52- /**
53- * {@link BigDecimal}に変換します。
54- *
55- * @param o
56- * @return {@link BigDecimal}に変換されたデータ
57- */
58- public static BigDecimal toBigDecimal(Object o) {
59- return toBigDecimal(o, null);
60- }
61-
62- /**
63- * {@link BigDecimal}に変換します。
64- *
65- * @param o
66- * @param pattern
67- * @return {@link BigDecimal}に変換されたデータ
68- */
69- public static BigDecimal toBigDecimal(Object o, String pattern) {
70- if (o == null) {
71- return null;
72- } else if (o instanceof BigDecimal) {
73- return (BigDecimal) o;
74- } else if (o instanceof java.util.Date) {
75- if (pattern != null) {
76- return new BigDecimal(new SimpleDateFormat(pattern).format(o));
77- }
78- return new BigDecimal(Long.toString(((java.util.Date) o).getTime()));
79- } else if (o instanceof String) {
80- String s = (String) o;
81- if (StringUtil.isEmpty(s)) {
82- return null;
83- }
84- return normalizer.normalize(new BigDecimal(s));
85- } else {
86- return normalizer.normalize(new BigDecimal(o.toString()));
87- }
88- }
89-
90- /**
91- * {@link BigDecimal}を文字列に変換します。
92- *
93- * @param dec
94- * @return 文字列に変換されたデータ
95- */
96- public static String toString(BigDecimal dec) {
97- return normalizer.toString(dec);
98- }
99-
100- /**
101- * {@link BigDecimal}を正規化するためのインターフェースです。
102- * これは、Java5からtoString()のロジックが変わったことに対応するためです。
103- *
104- */
105- public interface BigDecimalNormalizer {
106-
107- /**
108- * 正規化します。
109- *
110- * @param dec
111- * @return 正規化された{@link BigDecimal}
112- */
113- BigDecimal normalize(BigDecimal dec);
114-
115- /**
116- * {@link BigDecimal}を文字列に変換します。
117- *
118- * @param dec
119- * @return
120- */
121- String toString(BigDecimal dec);
122- }
123-
124- /**
125- * デフォルトの{@link BigDecimalConversionUtil.BigDecimalNormalizer}の実装クラスです。
126- *
127- */
128- public static class DefaultNormalizer implements BigDecimalNormalizer {
129- public BigDecimal normalize(final BigDecimal dec) {
130- return dec;
131- }
132-
133- public String toString(final BigDecimal dec) {
134- return dec.toString();
135- }
136- }
13735 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassTraversal.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassTraversal.java (revision 31)
@@ -16,12 +16,11 @@
1616 package org.seasar.framework.util;
1717
1818 import java.io.File;
19-import java.util.Enumeration;
20-import java.util.jar.JarEntry;
2119 import java.util.jar.JarFile;
22-import java.util.zip.ZipEntry;
2320 import java.util.zip.ZipInputStream;
2421
22+import org.seasar.util.io.ClassTraversalUtil;
23+
2524 /**
2625 * クラスを横断して処理するためのハンドラです。
2726 * <p>
@@ -31,7 +30,7 @@
3130 * @author koichik
3231 * @see ResourcesUtil
3332 */
34-public class ClassTraversal {
33+public class ClassTraversal extends ClassTraversalUtil {
3534 private static final String CLASS_SUFFIX = ".class";
3635
3736 private static final String WAR_FILE_EXTENSION = ".war";
@@ -42,7 +41,7 @@
4241 * クラスを横断して処理するためのハンドラです。
4342 *
4443 */
45- public interface ClassHandler {
44+ public interface ClassHandler extends org.seasar.util.io.ClassHandler {
4645 /**
4746 * クラスを処理します。
4847 *
@@ -59,7 +58,7 @@
5958 * @param handler
6059 */
6160 public static void forEach(final File rootDir, final ClassHandler handler) {
62- forEach(rootDir, null, handler);
61+ ClassTraversalUtil.forEach(rootDir, handler);
6362 }
6463
6564 /**
@@ -74,10 +73,7 @@
7473 */
7574 public static void forEach(final File rootDir, final String rootPackage,
7675 final ClassHandler handler) {
77- final File packageDir = getPackageDir(rootDir, rootPackage);
78- if (packageDir.exists()) {
79- traverseFileSystem(packageDir, rootPackage, handler);
80- }
76+ ClassTraversalUtil.forEach(rootDir, rootPackage, handler);
8177 }
8278
8379 /**
@@ -96,11 +92,7 @@
9692 * クラスを処理するハンドラ
9793 */
9894 public static void forEach(final JarFile jarFile, final ClassHandler handler) {
99- if (jarFile.getName().toLowerCase().endsWith(WAR_FILE_EXTENSION)) {
100- forEach(jarFile, WEB_INF_CLASSES_PATH, handler);
101- } else {
102- forEach(jarFile, "", handler);
103- }
95+ ClassTraversalUtil.forEach(jarFile, handler);
10496 }
10597
10698 /**
@@ -121,24 +113,7 @@
121113 */
122114 public static void forEach(final JarFile jarFile, final String prefix,
123115 final ClassHandler handler) {
124- final int startPos = prefix.length();
125- final Enumeration enumeration = jarFile.entries();
126- while (enumeration.hasMoreElements()) {
127- final JarEntry entry = (JarEntry) enumeration.nextElement();
128- final String entryName = entry.getName().replace('\\', '/');
129- if (entryName.startsWith(prefix)
130- && entryName.endsWith(CLASS_SUFFIX)) {
131- final String className = entryName.substring(startPos,
132- entryName.length() - CLASS_SUFFIX.length()).replace(
133- '/', '.');
134- final int pos = className.lastIndexOf('.');
135- final String packageName = (pos == -1) ? null : className
136- .substring(0, pos);
137- final String shortClassName = (pos == -1) ? className
138- : className.substring(pos + 1);
139- handler.processClass(packageName, shortClassName);
140- }
141- }
116+ ClassTraversalUtil.forEach(jarFile, prefix, handler);
142117 }
143118
144119 /**
@@ -153,7 +128,7 @@
153128 */
154129 public static void forEach(final ZipInputStream zipInputStream,
155130 final ClassHandler handler) {
156- forEach(zipInputStream, "", handler);
131+ ClassTraversalUtil.forEach(zipInputStream, handler);
157132 }
158133
159134 /**
@@ -174,56 +149,7 @@
174149 */
175150 public static void forEach(final ZipInputStream zipInputStream,
176151 final String prefix, final ClassHandler handler) {
177- final int startPos = prefix.length();
178- ZipEntry entry = null;
179- while ((entry = ZipInputStreamUtil.getNextEntry(zipInputStream)) != null) {
180- try {
181- final String entryName = entry.getName().replace('\\', '/');
182- if (entryName.startsWith(prefix)
183- && entryName.endsWith(CLASS_SUFFIX)) {
184- final String className = entryName.substring(startPos,
185- entryName.length() - CLASS_SUFFIX.length())
186- .replace('/', '.');
187- final int pos = className.lastIndexOf('.');
188- final String packageName = (pos == -1) ? null : className
189- .substring(0, pos);
190- final String shortClassName = (pos == -1) ? className
191- : className.substring(pos + 1);
192- handler.processClass(packageName, shortClassName);
193- }
194- } finally {
195- ZipInputStreamUtil.closeEntry(zipInputStream);
196- }
197- }
152+ ClassTraversalUtil.forEach(zipInputStream, prefix, handler);
198153 }
199154
200- private static void traverseFileSystem(final File dir,
201- final String packageName, final ClassHandler handler) {
202- final File[] files = dir.listFiles();
203- for (int i = 0; i < files.length; ++i) {
204- final File file = files[i];
205- final String fileName = file.getName();
206- if (file.isDirectory()) {
207- traverseFileSystem(file, ClassUtil.concatName(packageName,
208- fileName), handler);
209- } else if (fileName.endsWith(".class")) {
210- final String shortClassName = fileName.substring(0, fileName
211- .length()
212- - CLASS_SUFFIX.length());
213- handler.processClass(packageName, shortClassName);
214- }
215- }
216- }
217-
218- private static File getPackageDir(final File rootDir,
219- final String rootPackage) {
220- File packageDir = rootDir;
221- if (rootPackage != null) {
222- final String[] names = rootPackage.split("\\.");
223- for (int i = 0; i < names.length; i++) {
224- packageDir = new File(packageDir, names[i]);
225- }
226- }
227- return packageDir;
228- }
229155 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassUtil.java (revision 31)
@@ -15,23 +15,12 @@
1515 */
1616 package org.seasar.framework.util;
1717
18-import java.lang.reflect.Constructor;
1918 import java.lang.reflect.Field;
20-import java.lang.reflect.Method;
21-import java.util.HashMap;
22-import java.util.Map;
2319
2420 import javassist.ClassPool;
2521 import javassist.CtClass;
2622 import javassist.CtField;
2723
28-import org.seasar.framework.exception.ClassNotFoundRuntimeException;
29-import org.seasar.framework.exception.IllegalAccessRuntimeException;
30-import org.seasar.framework.exception.InstantiationRuntimeException;
31-import org.seasar.framework.exception.NoSuchConstructorRuntimeException;
32-import org.seasar.framework.exception.NoSuchFieldRuntimeException;
33-import org.seasar.framework.exception.NoSuchMethodRuntimeException;
34-
3524 /**
3625 * {@link Class}用のユーティリティクラスです。
3726 *
@@ -38,43 +27,8 @@
3827 * @author higa
3928 *
4029 */
41-public class ClassUtil {
30+public class ClassUtil extends org.seasar.util.lang.ClassUtil {
4231
43- private static Map wrapperToPrimitiveMap = new HashMap();
44-
45- private static Map primitiveToWrapperMap = new HashMap();
46-
47- private static Map primitiveClassNameMap = new HashMap();
48-
49- static {
50- wrapperToPrimitiveMap.put(Character.class, Character.TYPE);
51- wrapperToPrimitiveMap.put(Byte.class, Byte.TYPE);
52- wrapperToPrimitiveMap.put(Short.class, Short.TYPE);
53- wrapperToPrimitiveMap.put(Integer.class, Integer.TYPE);
54- wrapperToPrimitiveMap.put(Long.class, Long.TYPE);
55- wrapperToPrimitiveMap.put(Double.class, Double.TYPE);
56- wrapperToPrimitiveMap.put(Float.class, Float.TYPE);
57- wrapperToPrimitiveMap.put(Boolean.class, Boolean.TYPE);
58-
59- primitiveToWrapperMap.put(Character.TYPE, Character.class);
60- primitiveToWrapperMap.put(Byte.TYPE, Byte.class);
61- primitiveToWrapperMap.put(Short.TYPE, Short.class);
62- primitiveToWrapperMap.put(Integer.TYPE, Integer.class);
63- primitiveToWrapperMap.put(Long.TYPE, Long.class);
64- primitiveToWrapperMap.put(Double.TYPE, Double.class);
65- primitiveToWrapperMap.put(Float.TYPE, Float.class);
66- primitiveToWrapperMap.put(Boolean.TYPE, Boolean.class);
67-
68- primitiveClassNameMap.put(Character.TYPE.getName(), Character.TYPE);
69- primitiveClassNameMap.put(Byte.TYPE.getName(), Byte.TYPE);
70- primitiveClassNameMap.put(Short.TYPE.getName(), Short.TYPE);
71- primitiveClassNameMap.put(Integer.TYPE.getName(), Integer.TYPE);
72- primitiveClassNameMap.put(Long.TYPE.getName(), Long.TYPE);
73- primitiveClassNameMap.put(Double.TYPE.getName(), Double.TYPE);
74- primitiveClassNameMap.put(Float.TYPE.getName(), Float.TYPE);
75- primitiveClassNameMap.put(Boolean.TYPE.getName(), Boolean.TYPE);
76- }
77-
7832 /**
7933 *
8034 */
@@ -82,273 +36,17 @@
8236 }
8337
8438 /**
85- * {@link Class}を返します。
39+ * FQCNからパッケージ名を除いた名前を返します。
8640 *
87- * @param className
88- * @return {@link Class}
89- * @throws ClassNotFoundRuntimeException
90- * {@link ClassNotFoundException}がおきた場合
91- * @see Class#forName(String)
92- */
93- public static Class forName(String className)
94- throws ClassNotFoundRuntimeException {
95-
96- ClassLoader loader = Thread.currentThread().getContextClassLoader();
97- try {
98- return Class.forName(className, true, loader);
99- } catch (ClassNotFoundException ex) {
100- throw new ClassNotFoundRuntimeException(className, ex);
101- }
102- }
103-
104- /**
105- * プリミティブクラスの場合は、ラッパークラスに変換して返します。
106- *
107- * @param className
108- * @return {@link Class}
109- * @throws ClassNotFoundRuntimeException
110- * {@link ClassNotFoundException}がおきた場合
111- * @see #forName(String)
112- */
113- public static Class convertClass(String className)
114- throws ClassNotFoundRuntimeException {
115- Class clazz = (Class) primitiveClassNameMap.get(className);
116- if (clazz != null) {
117- return clazz;
118- }
119- return forName(className);
120- }
121-
122- /**
123- * 新しいインスタンスを作成します。
124- *
12541 * @param clazz
126- * @return 新しいインスタンス
127- * @throws InstantiationRuntimeException
128- * {@link InstantiationException}がおきた場合
129- * @throws IllegalAccessRuntimeException
130- * {@link IllegalAccessException}がおきた場合
131- * @see Class#newInstance()
42+ * @return FQCNからパッケージ名を除いた名前
43+ * @see #getShortClassName(String)
13244 */
133- public static Object newInstance(Class clazz)
134- throws InstantiationRuntimeException, IllegalAccessRuntimeException {
135-
136- try {
137- return clazz.newInstance();
138- } catch (InstantiationException ex) {
139- throw new InstantiationRuntimeException(clazz, ex);
140- } catch (IllegalAccessException ex) {
141- throw new IllegalAccessRuntimeException(clazz, ex);
142- }
45+ public static String getShortClassName(Class<?> clazz) {
46+ return getShortClassName(clazz.getName());
14347 }
14448
14549 /**
146- * 新しいインスタンスを作成します。
147- *
148- * @param className
149- * @return 新しいインスタンス
150- * @throws ClassNotFoundRuntimeException
151- * {@link ClassNotFoundException}がおきた場合
152- * @throws InstantiationRuntimeException
153- * {@link InstantiationException}がおきた場合
154- * @throws IllegalAccessRuntimeException
155- * {@link IllegalAccessException}がおきた場合
156- * @see #newInstance(Class)
157- */
158- public static Object newInstance(String className)
159- throws ClassNotFoundRuntimeException,
160- InstantiationRuntimeException, IllegalAccessRuntimeException {
161-
162- return newInstance(forName(className));
163- }
164-
165- /**
166- * 代入可能かどうかを返します。
167- *
168- * @param toClass
169- * @param fromClass
170- * @return 代入可能かどうか
171- * @see Class#isAssignableFrom(Class)
172- */
173- public static boolean isAssignableFrom(Class toClass, Class fromClass) {
174- if (toClass == Object.class && !fromClass.isPrimitive()) {
175- return true;
176- }
177- if (toClass.isPrimitive()) {
178- fromClass = getPrimitiveClassIfWrapper(fromClass);
179- }
180- return toClass.isAssignableFrom(fromClass);
181- }
182-
183- /**
184- * ラッパークラスをプリミティブクラスに変換します。
185- *
186- * @param clazz
187- * @return プリミティブクラス
188- */
189- public static Class getPrimitiveClass(Class clazz) {
190- return (Class) wrapperToPrimitiveMap.get(clazz);
191- }
192-
193- /**
194- * ラッパークラスならプリミティブクラスに、 そうでなければそのままクラスを返します。
195- *
196- * @param clazz
197- * @return {@link Class}
198- */
199- public static Class getPrimitiveClassIfWrapper(Class clazz) {
200- Class ret = getPrimitiveClass(clazz);
201- if (ret != null) {
202- return ret;
203- }
204- return clazz;
205- }
206-
207- /**
208- * プリミティブクラスをラッパークラスに変換します。
209- *
210- * @param clazz
211- * @return {@link Class}
212- */
213- public static Class getWrapperClass(Class clazz) {
214- return (Class) primitiveToWrapperMap.get(clazz);
215- }
216-
217- /**
218- * プリミティブの場合はラッパークラス、そうでない場合はもとのクラスを返します。
219- *
220- * @param clazz
221- * @return {@link Class}
222- */
223- public static Class getWrapperClassIfPrimitive(Class clazz) {
224- Class ret = getWrapperClass(clazz);
225- if (ret != null) {
226- return ret;
227- }
228- return clazz;
229- }
230-
231- /**
232- * {@link Constructor}を返します。
233- *
234- * @param clazz
235- * @param argTypes
236- * @return {@link Constructor}
237- * @throws NoSuchConstructorRuntimeException
238- * {@link NoSuchMethodException}がおきた場合
239- * @see Class#getConstructor(Class[])
240- */
241- public static Constructor getConstructor(Class clazz, Class[] argTypes)
242- throws NoSuchConstructorRuntimeException {
243- try {
244- return clazz.getConstructor(argTypes);
245- } catch (NoSuchMethodException ex) {
246- throw new NoSuchConstructorRuntimeException(clazz, argTypes, ex);
247- }
248- }
249-
250- /**
251- * そのクラスに宣言されている {@link Constructor}を返します。
252- *
253- * @param clazz
254- * @param argTypes
255- * @return {@link Constructor}
256- * @throws NoSuchConstructorRuntimeException
257- * {@link NoSuchMethodException}がおきた場合
258- * @see Class#getDeclaredConstructor(Class[])
259- */
260- public static Constructor getDeclaredConstructor(Class clazz,
261- Class[] argTypes) throws NoSuchConstructorRuntimeException {
262- try {
263- return clazz.getDeclaredConstructor(argTypes);
264- } catch (NoSuchMethodException ex) {
265- throw new NoSuchConstructorRuntimeException(clazz, argTypes, ex);
266- }
267- }
268-
269- /**
270- * {@link Method}を返します。
271- *
272- * @param clazz
273- * @param methodName
274- * @param argTypes
275- * @return {@link Method}
276- * @throws NoSuchMethodRuntimeException
277- * {@link NoSuchMethodException}がおきた場合
278- * @see Class#getMethod(String, Class[])
279- */
280- public static Method getMethod(Class clazz, String methodName,
281- Class[] argTypes) throws NoSuchMethodRuntimeException {
282-
283- try {
284- return clazz.getMethod(methodName, argTypes);
285- } catch (NoSuchMethodException ex) {
286- throw new NoSuchMethodRuntimeException(clazz, methodName, argTypes,
287- ex);
288- }
289- }
290-
291- /**
292- * そのクラスに宣言されている {@link Method}を返します。
293- *
294- * @param clazz
295- * @param methodName
296- * @param argTypes
297- * @return {@link Method}
298- * @throws NoSuchMethodRuntimeException
299- * {@link NoSuchMethodException}がおきた場合
300- * @see Class#getDeclaredMethod(String, Class[])
301- */
302- public static Method getDeclaredMethod(Class clazz, String methodName,
303- Class[] argTypes) throws NoSuchMethodRuntimeException {
304-
305- try {
306- return clazz.getDeclaredMethod(methodName, argTypes);
307- } catch (NoSuchMethodException ex) {
308- throw new NoSuchMethodRuntimeException(clazz, methodName, argTypes,
309- ex);
310- }
311- }
312-
313- /**
314- * {@link Field}を返します。
315- *
316- * @param clazz
317- * @param fieldName
318- * @return {@link Field}
319- * @throws NoSuchFieldRuntimeException
320- * {@link NoSuchFieldException}がおきた場合
321- * @see Class#getField(String)
322- */
323- public static Field getField(Class clazz, String fieldName)
324- throws NoSuchFieldRuntimeException {
325- try {
326- return clazz.getField(fieldName);
327- } catch (NoSuchFieldException ex) {
328- throw new NoSuchFieldRuntimeException(clazz, fieldName, ex);
329- }
330- }
331-
332- /**
333- * そのクラスに宣言されている {@link Field}を返します。
334- *
335- * @param clazz
336- * @param fieldName
337- * @return {@link Field}
338- * @throws NoSuchFieldRuntimeException
339- * {@link NoSuchFieldException}がおきた場合
340- * @see Class#getDeclaredField(String)
341- */
342- public static Field getDeclaredField(Class clazz, String fieldName)
343- throws NoSuchFieldRuntimeException {
344- try {
345- return clazz.getDeclaredField(fieldName);
346- } catch (NoSuchFieldException ex) {
347- throw new NoSuchFieldRuntimeException(clazz, fieldName, ex);
348- }
349- }
350-
351- /**
35250 * このクラスに定義された{@link Field フィールド}をクラスファイルに定義された順番で返します。
35351 *
35452 * @param clazz
@@ -355,7 +53,7 @@
35553 * 対象のクラス
35654 * @return このクラスに定義されたフィールドの配列
35755 */
358- public static Field[] getDeclaredFields(final Class clazz) {
56+ public static Field[] getDeclaredFields(final Class<?> clazz) {
35957 final ClassPool pool = ClassPoolUtil.getClassPool(clazz);
36058 final CtClass ctClass = ClassPoolUtil.toCtClass(pool, clazz);
36159 final CtField[] ctFields = ctClass.getDeclaredFields();
@@ -362,121 +60,9 @@
36260 final int size = ctFields.length;
36361 final Field[] fields = new Field[size];
36462 for (int i = 0; i < size; ++i) {
365- fields[i] = ClassUtil
366- .getDeclaredField(clazz, ctFields[i].getName());
63+ fields[i] = getDeclaredField(clazz, ctFields[i].getName());
36764 }
36865 return fields;
36966 }
37067
371- /**
372- * パッケージ名を返します。
373- *
374- * @param clazz
375- * @return パッケージ名
376- */
377- public static String getPackageName(Class clazz) {
378- String fqcn = clazz.getName();
379- int pos = fqcn.lastIndexOf('.');
380- if (pos > 0) {
381- return fqcn.substring(0, pos);
382- }
383- return null;
384- }
385-
386- /**
387- * FQCNからパッケージ名を除いた名前を返します。
388- *
389- * @param clazz
390- * @return FQCNからパッケージ名を除いた名前
391- * @see #getShortClassName(String)
392- */
393- public static String getShortClassName(Class clazz) {
394- return getShortClassName(clazz.getName());
395- }
396-
397- /**
398- * FQCNからパッケージ名を除いた名前を返します。
399- *
400- * @param className
401- * @return FQCNからパッケージ名を除いた名前
402- */
403- public static String getShortClassName(String className) {
404- int i = className.lastIndexOf('.');
405- if (i > 0) {
406- return className.substring(i + 1);
407- }
408- return className;
409- }
410-
411- /**
412- * FQCNをパッケージ名とFQCNからパッケージ名を除いた名前に分けます。
413- *
414- * @param className
415- * @return パッケージ名とFQCNからパッケージ名を除いた名前
416- */
417- public static String[] splitPackageAndShortClassName(String className) {
418- String[] ret = new String[2];
419- int i = className.lastIndexOf('.');
420- if (i > 0) {
421- ret[0] = className.substring(0, i);
422- ret[1] = className.substring(i + 1);
423- } else {
424- ret[1] = className;
425- }
426- return ret;
427- }
428-
429- /**
430- * 配列の場合は要素のクラス名、それ以外はクラス名そのものを返します。
431- *
432- * @param clazz
433- * @return クラス名
434- */
435- public static String getSimpleClassName(final Class clazz) {
436- if (clazz.isArray()) {
437- return getSimpleClassName(clazz.getComponentType()) + "[]";
438- }
439- return clazz.getName();
440- }
441-
442- /**
443- * クラス名をリソースパスとして表現します。
444- *
445- * @param clazz
446- * @return リソースパス
447- * @see #getResourcePath(String)
448- */
449- public static String getResourcePath(Class clazz) {
450- return getResourcePath(clazz.getName());
451- }
452-
453- /**
454- * クラス名をリソースパスとして表現します。
455- *
456- * @param className
457- * @return リソースパス
458- */
459- public static String getResourcePath(String className) {
460- return StringUtil.replace(className, ".", "/") + ".class";
461- }
462-
463- /**
464- * クラス名の要素を結合します。
465- *
466- * @param s1
467- * @param s2
468- * @return 結合された名前
469- */
470- public static String concatName(String s1, String s2) {
471- if (StringUtil.isEmpty(s1) && StringUtil.isEmpty(s2)) {
472- return null;
473- }
474- if (!StringUtil.isEmpty(s1) && StringUtil.isEmpty(s2)) {
475- return s1;
476- }
477- if (StringUtil.isEmpty(s1) && !StringUtil.isEmpty(s2)) {
478- return s2;
479- }
480- return s1 + '.' + s2;
481- }
48268 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/AssertionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/AssertionUtil.java (revision 31)
@@ -22,7 +22,7 @@
2222 *
2323 * @author shot
2424 */
25-public class AssertionUtil {
25+public class AssertionUtil extends org.seasar.util.misc.AssertionUtil {
2626
2727 /**
2828 * インスタンスを構築します。
@@ -40,9 +40,7 @@
4040 */
4141 public static void assertNotNull(String message, Object obj)
4242 throws NullPointerException {
43- if (obj == null) {
44- throw new NullPointerException(message);
45- }
43+ org.seasar.util.misc.AssertionUtil.assertArgumentNotNull(message, obj);
4644 }
4745
4846 /**
@@ -55,9 +53,7 @@
5553 */
5654 public static void assertNotEmpty(String message, String s)
5755 throws EmptyRuntimeException {
58- if (StringUtil.isEmpty(s)) {
59- throw new EmptyRuntimeException(message);
60- }
56+ org.seasar.util.misc.AssertionUtil.assertArgumentNotEmpty(message, s);
6157 }
6258
6359 /**
@@ -70,6 +66,7 @@
7066 */
7167 public static void assertIntegerNotNegative(String message, int num)
7268 throws IllegalArgumentException {
69+ // TODO not found
7370 if (num < 0) {
7471 throw new IllegalArgumentException(message);
7572 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/Base64Util.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/Base64Util.java (revision 31)
@@ -21,155 +21,6 @@
2121 * @author higa
2222 *
2323 */
24-public class Base64Util {
24+public class Base64Util extends org.seasar.util.misc.Base64Util {
2525
26- private static final char[] ENCODE_TABLE = { 'A', 'B', 'C', 'D', 'E', 'F',
27- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
28- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
29- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
30- 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5',
31- '6', '7', '8', '9', '+', '/' };
32-
33- private static final char PAD = '=';
34-
35- private static final byte[] DECODE_TABLE = new byte[128];
36- static {
37- for (int i = 0; i < DECODE_TABLE.length; i++) {
38- DECODE_TABLE[i] = Byte.MAX_VALUE;
39- }
40- for (int i = 0; i < ENCODE_TABLE.length; i++) {
41- DECODE_TABLE[ENCODE_TABLE[i]] = (byte) i;
42- }
43- }
44-
45- /**
46- * Base64でエンコードします。
47- *
48- * @param inData
49- * @return エンコードされたデータ
50- */
51- public static String encode(final byte[] inData) {
52- if (inData == null || inData.length == 0) {
53- return "";
54- }
55- int mod = inData.length % 3;
56- int num = inData.length / 3;
57- char[] outData = null;
58- if (mod != 0) {
59- outData = new char[(num + 1) * 4];
60- } else {
61- outData = new char[num * 4];
62- }
63- for (int i = 0; i < num; i++) {
64- encode(inData, i * 3, outData, i * 4);
65- }
66- switch (mod) {
67- case 1:
68- encode2pad(inData, num * 3, outData, num * 4);
69- break;
70- case 2:
71- encode1pad(inData, num * 3, outData, num * 4);
72- break;
73- }
74- return new String(outData);
75- }
76-
77- /**
78- * Base64でエンコードされたデータをデコードします。
79- *
80- * @param inData
81- * @return デコードされたデータ
82- */
83- public static byte[] decode(final String inData) {
84- int num = (inData.length() / 4) - 1;
85- int lastBytes = getLastBytes(inData);
86- byte[] outData = new byte[num * 3 + lastBytes];
87- for (int i = 0; i < num; i++) {
88- decode(inData, i * 4, outData, i * 3);
89- }
90- switch (lastBytes) {
91- case 1:
92- decode1byte(inData, num * 4, outData, num * 3);
93- break;
94- case 2:
95- decode2byte(inData, num * 4, outData, num * 3);
96- break;
97- default:
98- decode(inData, num * 4, outData, num * 3);
99- }
100- return outData;
101- }
102-
103- private static void encode(final byte[] inData, final int inIndex,
104- final char[] outData, final int outIndex) {
105-
106- int i = ((inData[inIndex] & 0xff) << 16)
107- + ((inData[inIndex + 1] & 0xff) << 8)
108- + (inData[inIndex + 2] & 0xff);
109- outData[outIndex] = ENCODE_TABLE[i >> 18];
110- outData[outIndex + 1] = ENCODE_TABLE[(i >> 12) & 0x3f];
111- outData[outIndex + 2] = ENCODE_TABLE[(i >> 6) & 0x3f];
112- outData[outIndex + 3] = ENCODE_TABLE[i & 0x3f];
113- }
114-
115- private static void encode2pad(final byte[] inData, final int inIndex,
116- final char[] outData, final int outIndex) {
117-
118- int i = inData[inIndex] & 0xff;
119- outData[outIndex] = ENCODE_TABLE[i >> 2];
120- outData[outIndex + 1] = ENCODE_TABLE[(i << 4) & 0x3f];
121- outData[outIndex + 2] = PAD;
122- outData[outIndex + 3] = PAD;
123- }
124-
125- private static void encode1pad(final byte[] inData, final int inIndex,
126- final char[] outData, final int outIndex) {
127-
128- int i = ((inData[inIndex] & 0xff) << 8) + (inData[inIndex + 1] & 0xff);
129- outData[outIndex] = ENCODE_TABLE[i >> 10];
130- outData[outIndex + 1] = ENCODE_TABLE[(i >> 4) & 0x3f];
131- outData[outIndex + 2] = ENCODE_TABLE[(i << 2) & 0x3f];
132- outData[outIndex + 3] = PAD;
133- }
134-
135- private static void decode(final String inData, final int inIndex,
136- final byte[] outData, final int outIndex) {
137-
138- byte b0 = DECODE_TABLE[inData.charAt(inIndex)];
139- byte b1 = DECODE_TABLE[inData.charAt(inIndex + 1)];
140- byte b2 = DECODE_TABLE[inData.charAt(inIndex + 2)];
141- byte b3 = DECODE_TABLE[inData.charAt(inIndex + 3)];
142- outData[outIndex] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
143- outData[outIndex + 1] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
144- outData[outIndex + 2] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);
145- }
146-
147- private static void decode1byte(final String inData, final int inIndex,
148- final byte[] outData, final int outIndex) {
149-
150- byte b0 = DECODE_TABLE[inData.charAt(inIndex)];
151- byte b1 = DECODE_TABLE[inData.charAt(inIndex + 1)];
152- outData[outIndex] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
153- }
154-
155- private static void decode2byte(final String inData, final int inIndex,
156- final byte[] outData, final int outIndex) {
157-
158- byte b0 = DECODE_TABLE[inData.charAt(inIndex)];
159- byte b1 = DECODE_TABLE[inData.charAt(inIndex + 1)];
160- byte b2 = DECODE_TABLE[inData.charAt(inIndex + 2)];
161- outData[outIndex] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
162- outData[outIndex + 1] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
163- }
164-
165- private static int getLastBytes(final String inData) {
166- int len = inData.length();
167- if (inData.charAt(len - 2) == PAD) {
168- return 1;
169- } else if (inData.charAt(len - 1) == PAD) {
170- return 2;
171- } else {
172- return 3;
173- }
174- }
17526 }
\ No newline at end of file
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BigIntegerConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BigIntegerConversionUtil.java (revision 31)
@@ -23,7 +23,8 @@
2323 * @author higa
2424 *
2525 */
26-public class BigIntegerConversionUtil {
26+public class BigIntegerConversionUtil extends
27+ org.seasar.util.convert.BigIntegerConversionUtil {
2728
2829 /**
2930 * インスタンスを構築します。
@@ -31,34 +32,4 @@
3132 protected BigIntegerConversionUtil() {
3233 }
3334
34- /**
35- * {@link BigInteger}に変換します。
36- *
37- * @param o
38- * @return {@link BigInteger}
39- */
40- public static BigInteger toBigInteger(Object o) {
41- return toBigInteger(o, null);
42- }
43-
44- /**
45- * {@link BigInteger}に変換します。
46- *
47- * @param o
48- * @param pattern
49- * @return {@link BigInteger}
50- */
51- public static BigInteger toBigInteger(Object o, String pattern) {
52- if (o == null) {
53- return null;
54- } else if (o instanceof BigInteger) {
55- return (BigInteger) o;
56- } else {
57- Long l = LongConversionUtil.toLong(o, pattern);
58- if (l == null) {
59- return null;
60- }
61- return BigInteger.valueOf(l.longValue());
62- }
63- }
6435 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BooleanConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/BooleanConversionUtil.java (revision 31)
@@ -21,7 +21,8 @@
2121 * @author higa
2222 *
2323 */
24-public class BooleanConversionUtil {
24+public class BooleanConversionUtil extends
25+ org.seasar.util.convert.BooleanConversionUtil {
2526
2627 /**
2728 * インスタンスを構築します。
@@ -29,47 +30,4 @@
2930 protected BooleanConversionUtil() {
3031 }
3132
32- /**
33- * {@link Boolean}に変換します。
34- *
35- * @param o
36- * @return {@link Boolean}
37- */
38- public static Boolean toBoolean(Object o) {
39- if (o == null) {
40- return null;
41- } else if (o instanceof Boolean) {
42- return (Boolean) o;
43- } else if (o instanceof Number) {
44- int num = ((Number) o).intValue();
45- return Boolean.valueOf(num != 0);
46- } else if (o instanceof String) {
47- String s = (String) o;
48- if ("true".equalsIgnoreCase(s)) {
49- return Boolean.TRUE;
50- } else if ("false".equalsIgnoreCase(s)) {
51- return Boolean.FALSE;
52- } else if (s.equals("0")) {
53- return Boolean.FALSE;
54- } else {
55- return Boolean.TRUE;
56- }
57- } else {
58- return Boolean.TRUE;
59- }
60- }
61-
62- /**
63- * booleanに変換します。
64- *
65- * @param o
66- * @return boolean
67- */
68- public static boolean toPrimitiveBoolean(Object o) {
69- Boolean b = toBoolean(o);
70- if (b != null) {
71- return b.booleanValue();
72- }
73- return false;
74- }
7533 }
\ No newline at end of file
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveMap.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CaseInsensitiveMap.java (revision 31)
@@ -15,7 +15,6 @@
1515 */
1616 package org.seasar.framework.util;
1717
18-import java.util.Map;
1918
2019 /**
2120 * キーで大文字小文字を気にしない {@link ArrayMap}です。
@@ -27,7 +26,8 @@
2726 *
2827 * @author higa
2928 */
30-public class CaseInsensitiveMap<K, V> extends ArrayMap<K, V> {
29+public class CaseInsensitiveMap<V> extends
30+ org.seasar.util.collection.CaseInsensitiveMap<V> {
3131
3232 private static final long serialVersionUID = 1L;
3333
@@ -47,41 +47,4 @@
4747 super(capacity);
4848 }
4949
50- /**
51- * キーが含まれているかどうかを返します。
52- *
53- * @param key
54- * @return キーが含まれているかどうか
55- */
56- public final boolean containsKey(String key) {
57- return super.containsKey(convertKey(key));
58- }
59-
60- public final V get(Object key) {
61- return super.get(convertKey(key));
62- }
63-
64- public final V put(K key, V value) {
65- return super.put(convertKey(key), value);
66- }
67-
68- public final void putAll(Map<? extends K, ? extends V> map) {
69- for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
70- put(convertKey(entry.getKey()), entry.getValue());
71- }
72- }
73-
74- public final V remove(Object key) {
75- return super.remove(convertKey(key));
76- }
77-
78- public boolean containsKey(Object key) {
79- return super.containsKey(convertKey(key));
80- }
81-
82- @SuppressWarnings("unchecked")
83- private static <K> K convertKey(K key) {
84- return (K) key.toString().toLowerCase();
85- }
86-
8750 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ByteConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ByteConversionUtil.java (revision 31)
@@ -15,8 +15,6 @@
1515 */
1616 package org.seasar.framework.util;
1717
18-import java.text.SimpleDateFormat;
19-
2018 /**
2119 * {@link Byte}用の変換ユーティリティです。
2220 *
@@ -23,7 +21,8 @@
2321 * @author higa
2422 *
2523 */
26-public class ByteConversionUtil {
24+public class ByteConversionUtil extends
25+ org.seasar.util.convert.ByteConversionUtil {
2726
2827 /**
2928 * インスタンスを構築します。
@@ -31,92 +30,4 @@
3130 protected ByteConversionUtil() {
3231 }
3332
34- /**
35- * {@link Byte}に変換します。
36- *
37- * @param o
38- * @return {@link Byte}
39- */
40- public static Byte toByte(Object o) {
41- return toByte(o, null);
42- }
43-
44- /**
45- * {@link Byte}に変換します。
46- *
47- * @param o
48- * @param pattern
49- * @return {@link Byte}
50- */
51- public static Byte toByte(Object o, String pattern) {
52- if (o == null) {
53- return null;
54- } else if (o instanceof Byte) {
55- return (Byte) o;
56- } else if (o instanceof Number) {
57- return new Byte(((Number) o).byteValue());
58- } else if (o instanceof String) {
59- return toByte((String) o);
60- } else if (o instanceof java.util.Date) {
61- if (pattern != null) {
62- return new Byte(new SimpleDateFormat(pattern).format(o));
63- }
64- return new Byte((byte) ((java.util.Date) o).getTime());
65- } else if (o instanceof Boolean) {
66- return ((Boolean) o).booleanValue() ? new Byte((byte) 1)
67- : new Byte((byte) 0);
68- } else {
69- return toByte(o.toString());
70- }
71- }
72-
73- private static Byte toByte(String s) {
74- if (StringUtil.isEmpty(s)) {
75- return null;
76- }
77- return new Byte(DecimalFormatUtil.normalize(s));
78- }
79-
80- /**
81- * byteに変換します。
82- *
83- * @param o
84- * @return byte
85- */
86- public static byte toPrimitiveByte(Object o) {
87- return toPrimitiveByte(o, null);
88- }
89-
90- /**
91- * byteに変換します。
92- *
93- * @param o
94- * @param pattern
95- * @return byte
96- */
97- public static byte toPrimitiveByte(Object o, String pattern) {
98- if (o == null) {
99- return 0;
100- } else if (o instanceof Number) {
101- return ((Number) o).byteValue();
102- } else if (o instanceof String) {
103- return toPrimitiveByte((String) o);
104- } else if (o instanceof java.util.Date) {
105- if (pattern != null) {
106- return Byte.parseByte(new SimpleDateFormat(pattern).format(o));
107- }
108- return (byte) ((java.util.Date) o).getTime();
109- } else if (o instanceof Boolean) {
110- return ((Boolean) o).booleanValue() ? (byte) 1 : (byte) 0;
111- } else {
112- return toPrimitiveByte(o.toString());
113- }
114- }
115-
116- private static byte toPrimitiveByte(String s) {
117- if (StringUtil.isEmpty(s)) {
118- return 0;
119- }
120- return Byte.parseByte(DecimalFormatUtil.normalize(s));
121- }
12233 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CalendarConversionUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/CalendarConversionUtil.java (revision 31)
@@ -16,8 +16,6 @@
1616 package org.seasar.framework.util;
1717
1818 import java.util.Calendar;
19-import java.util.Locale;
20-import java.util.TimeZone;
2119
2220 /**
2321 * {@link Calendar}用の変換ユーティリティです。
@@ -25,7 +23,8 @@
2523 * @author higa
2624 *
2725 */
28-public class CalendarConversionUtil {
26+public class CalendarConversionUtil extends
27+ org.seasar.util.convert.CalendarConversionUtil {
2928
3029 /**
3130 * インスタンスを構築します。
@@ -33,49 +32,4 @@
3332 protected CalendarConversionUtil() {
3433 }
3534
36- /**
37- * {@link Calendar}に変換します。
38- *
39- * @param o
40- * @return {@link Calendar}
41- */
42- public static Calendar toCalendar(Object o) {
43- return toCalendar(o, null);
44- }
45-
46- /**
47- * {@link Calendar}に変換します。
48- *
49- * @param o
50- * @param pattern
51- * @return {@link Calendar}
52- */
53- public static Calendar toCalendar(Object o, String pattern) {
54- if (o instanceof Calendar) {
55- return (Calendar) o;
56- }
57- java.util.Date date = DateConversionUtil.toDate(o, pattern);
58- if (date != null) {
59- Calendar cal = Calendar.getInstance();
60- cal.setTime(date);
61- return cal;
62- }
63- return null;
64- }
65-
66- /**
67- * ローカルの{@link TimeZone}と{@link Locale}をもつ{@link Calendar}に変換します。
68- *
69- * @param calendar
70- * {@link Calendar}
71- * @return
72- */
73- public static Calendar localize(Calendar calendar) {
74- if (calendar == null) {
75- throw new NullPointerException("calendar");
76- }
77- Calendar localCalendar = Calendar.getInstance();
78- localCalendar.setTimeInMillis(calendar.getTimeInMillis());
79- return localCalendar;
80- }
8135 }
\ No newline at end of file
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassLoaderUtil.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/util/ClassLoaderUtil.java (revision 31)
@@ -15,29 +15,15 @@
1515 */
1616 package org.seasar.framework.util;
1717
18-import java.io.IOException;
19-import java.lang.reflect.Method;
20-import java.net.URL;
21-import java.util.Enumeration;
22-import java.util.Iterator;
2318
24-import org.seasar.framework.exception.ClassNotFoundRuntimeException;
25-import org.seasar.framework.exception.IORuntimeException;
26-import org.seasar.framework.message.MessageFormatter;
27-
2819 /**
2920 * {@link ClassLoader}を扱うためのユーティリティ・クラスです。
3021 *
3122 * @author koichik
3223 */
33-public abstract class ClassLoaderUtil {
24+public abstract class ClassLoaderUtil extends
25+ org.seasar.util.lang.ClassLoaderUtil {
3426
35- private static final Method findLoadedClassMethod = getFindLoadedClassMethod();
36-
37- private static final Method defineClassMethod = getDefineClassMethod();
38-
39- private static final Method definePackageMethod = getDefinePackageMethod();
40-
4127 /**
4228 * インスタンスを構築します。
4329 */
@@ -44,258 +30,4 @@
4430 protected ClassLoaderUtil() {
4531 }
4632
47- private static Method getFindLoadedClassMethod() {
48- final Method method = ClassUtil.getDeclaredMethod(ClassLoader.class,
49- "findLoadedClass", new Class[] { String.class });
50- method.setAccessible(true);
51- return method;
52- }
53-
54- private static Method getDefineClassMethod() {
55- final Method method = ClassUtil.getDeclaredMethod(ClassLoader.class,
56- "defineClass", new Class[] { String.class, byte[].class,
57- int.class, int.class });
58- method.setAccessible(true);
59- return method;
60- }
61-
62- private static Method getDefinePackageMethod() {
63- final Method method = ClassUtil.getDeclaredMethod(ClassLoader.class,
64- "definePackage", new Class[] { String.class, String.class,
65- String.class, String.class, String.class, String.class,
66- String.class, URL.class });
67- method.setAccessible(true);
68- return method;
69- }
70-
71- /**
72- * クラスローダを返します。
73- * <p>
74- * クラスローダは以下の順で検索します。
75- * </p>
76- * <ol>
77- * <li>呼び出されたスレッドにコンテキスト・クラスローダが設定されている場合はそのコンテキスト・クラスローダ</li>
78- * <li>ターゲット・クラスをロードしたクラスローダを取得できればそのクラスローダ</li>
79- * <li>このクラスをロードしたクラスローダを取得できればそのクラスローダ</li>
80- * <li>システムを取得できればそのクラスローダ</li>
81- * </ol>
82- * <p>
83- * ただし、ターゲット・クラスをロードしたクラスローダとこのクラスをロードしたクラスローダの両方が取得できた場合で、
84- * ターゲット・クラスをロードしたクラスローダがこのクラスをロードしたクラスローダの祖先であった場合は、
85- * このクラスをロードしたクラスローダを返します。
86- * </p>
87- *
88- * @param targetClass
89- * ターゲット・クラス
90- * @return クラスローダ
91- * @throws IllegalStateException
92- * クラスローダを取得できなかった場合
93- */
94- public static ClassLoader getClassLoader(final Class targetClass) {
95- final ClassLoader contextClassLoader = Thread.currentThread()
96- .getContextClassLoader();
97- if (contextClassLoader != null) {
98- return contextClassLoader;
99- }
100-
101- final ClassLoader targetClassLoader = targetClass.getClassLoader();
102- final ClassLoader thisClassLoader = ClassLoaderUtil.class
103- .getClassLoader();
104- if (targetClassLoader != null && thisClassLoader != null) {
105- if (isAncestor(thisClassLoader, targetClassLoader)) {
106- return thisClassLoader;
107- }
108- return targetClassLoader;
109- }
110- if (targetClassLoader != null) {
111- return targetClassLoader;
112- }
113- if (thisClassLoader != null) {
114- return thisClassLoader;
115- }
116-
117- final ClassLoader systemClassLoader = ClassLoader
118- .getSystemClassLoader();
119- if (systemClassLoader != null) {
120- return systemClassLoader;
121- }
122-
123- throw new IllegalStateException(MessageFormatter.getMessage("ESSR0001",
124- new Object[] { "ClassLoader" }));
125- }
126-
127- /**
128- * コンテキストクラスローダから指定された名前を持つすべてのリソースを探します。
129- *
130- * @param name
131- * リソース名
132- * @return リソースに対する URL
133- * オブジェクトの列挙。リソースが見つからなかった場合、列挙は空になる。クラスローダがアクセスを持たないリソースは列挙に入らない
134- * @see java.lang.ClassLoader#getResources(String)
135- */
136- public static Iterator getResources(final String name) {
137- return getResources(Thread.currentThread().getContextClassLoader(),
138- name);
139- }
140-
141- /**
142- * {@link #getClassLoader(Class)}が返すクラスローダから指定された名前を持つすべてのリソースを探します。
143- *
144- * @param targetClass
145- * ターゲット・クラス
146- * @param name
147- * リソース名
148- * @return リソースに対する URL
149- * オブジェクトの列挙。リソースが見つからなかった場合、列挙は空になる。クラスローダがアクセスを持たないリソースは列挙に入らない
150- * @see java.lang.ClassLoader#getResources(String)
151- */
152- public static Iterator getResources(final Class targetClass,
153- final String name) {
154- return getResources(getClassLoader(targetClass), name);
155- }
156-
157- /**
158- * 指定のクラスローダから指定された名前を持つすべてのリソースを探します。
159- *
160- * @param loader
161- * クラスローダ
162- * @param name
163- * リソース名
164- * @return リソースに対する URL
165- * オブジェクトの列挙。リソースが見つからなかった場合、列挙は空になる。クラスローダがアクセスを持たないリソースは列挙に入らない
166- * @see java.lang.ClassLoader#getResources(String)
167- */
168- public static Iterator getResources(final ClassLoader loader,
169- final String name) {
170- try {
171- final Enumeration e = loader.getResources(name);
172- return new EnumerationIterator(e);
173- } catch (final IOException e) {
174- throw new IORuntimeException(e);
175- }
176- }
177-
178- /**
179- * クラスローダ<code>other</code>がクラスローダ<code>cl</code>の祖先なら<code>true</code>を返します。
180- *
181- * @param cl
182- * クラスローダ
183- * @param other
184- * クラスローダ
185- * @return クラスローダ<code>other</code>がクラスローダ<code>cl</code>の祖先なら<code>true</code>
186- */
187- protected static boolean isAncestor(ClassLoader cl, final ClassLoader other) {
188- while (cl != null) {
189- if (cl == other) {
190- return true;
191- }
192- cl = cl.getParent();
193- }
194- return false;
195- }
196-
197- /**
198- * 指定のクラスローダまたはその祖先の暮らすローダが、 このバイナリ名を持つクラスの起動ローダとしてJava仮想マシンにより記録されていた場合は、
199- * 指定されたバイナリ名を持つクラスを返します。 記録されていなかった場合は<code>null</code>を返します。
200- *
201- * @param classLoader
202- * クラスローダ
203- * @param className
204- * クラスのバイナリ名
205- * @return <code>Class</code>オブジェクト。クラスがロードされていない場合は<code>null</code>
206- * @see java.lang.ClassLoader#findLoadedClass(String)
207- */
208- public static Class findLoadedClass(final ClassLoader classLoader,
209- final String className) {
210- for (ClassLoader loader = classLoader; loader != null; loader = loader
211- .getParent()) {
212- final Class clazz = (Class) MethodUtil.invoke(
213- findLoadedClassMethod, loader, new Object[] { className });
214- if (clazz != null) {
215- return clazz;
216- }
217- }
218- return null;
219- }
220-
221- /**
222- * バイトの配列を<code>Class</code>クラスのインスタンスに変換します。
223- *
224- * @param classLoader
225- * バイナリデータから<code>Class</code>クラスのインスタンスに変換するクラスローダ
226- * @param className
227- * クラスのバイナリ名
228- * @param bytes
229- * クラスデータを構成するバイト列
230- * @param offset
231- * クラスデータ<code>bytes</code>の開始オフセット
232- * @param length
233- * クラスデータの長さ
234- * @return 指定されたクラスデータから作成された<code>Class</code>オブジェクト
235- * @see java.lang.ClassLoader#defineClass(String, byte[], int, int)
236- */
237- public static Class defineClass(final ClassLoader classLoader,
238- final String className, final byte[] bytes, final int offset,
239- final int length) {
240- return (Class) MethodUtil.invoke(defineClassMethod, classLoader,
241- new Object[] { className, bytes, new Integer(offset),
242- new Integer(length) });
243- }
244-
245- /**
246- * 指定の<code>ClassLoader</code>で名前を使ってパッケージを定義します。
247- *
248- * @param classLoader
249- * パッケージを定義するクラスローダ
250- * @param name
251- * パッケージ名
252- * @param specTitle
253- * 仕様のタイトル
254- * @param specVersion
255- * 仕様のバージョン
256- * @param specVendor
257- * 仕様のベンダー
258- * @param implTitle
259- * 実装のタイトル
260- * @param implVersion
261- * 実装のバージョン
262- * @param implVendor
263- * 実装のベンダー
264- * @param sealBase
265- * <code>null</code>でない場合、このパッケージは指定されたコードソース<code>URL</code>オブジェクトを考慮してシールされる。そうでない場合、パッケージはシールされない
266- * @return 新しく定義された<code>Package</code>オブジェクト
267- * @see java.lang.ClassLoader#definePackage(String, String, String, String,
268- * String, String, String, URL)
269- */
270- public static Package definePackage(final ClassLoader classLoader,
271- final String name, final String specTitle,
272- final String specVersion, final String specVendor,
273- final String implTitle, final String implVersion,
274- final String implVendor, final URL sealBase) {
275- return (Package) MethodUtil.invoke(definePackageMethod, classLoader,
276- new Object[] { name, specTitle, specVersion, specVendor,
277- implTitle, implVersion, implVendor, sealBase });
278- }
279-
280- /**
281- * 指定されたバイナリ名を持つクラスをロードします。
282- *
283- * @param loader
284- * クラスローダ
285- * @param className
286- * クラスのバイナリ名
287- * @return 結果の<code>Class</code>オブジェクト
288- * @throws ClassNotFoundRuntimeException
289- * クラスが見つからなかった場合
290- * @see java.lang.ClassLoader#loadClass(String)
291- */
292- public static Class loadClass(final ClassLoader loader,
293- final String className) {
294- try {
295- return loader.loadClass(className);
296- } catch (final ClassNotFoundException e) {
297- throw new ClassNotFoundRuntimeException(e);
298- }
299- }
300-
30133 }
--- figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/exception/ClassNotFoundRuntimeException.java (revision 30)
+++ figer-s2-container/trunk/s2-framework/src/main/java/org/seasar/framework/exception/ClassNotFoundRuntimeException.java (revision 31)
@@ -21,12 +21,13 @@
2121 * @author higa
2222 *
2323 */
24-public class ClassNotFoundRuntimeException extends SRuntimeException {
24+// TODO 不要な可能性あり
25+@Deprecated
26+public class ClassNotFoundRuntimeException extends
27+ org.seasar.util.exception.ClassNotFoundRuntimeException {
2528
2629 private static final long serialVersionUID = -9022468864937761059L;
2730
28- private String className;
29-
3031 /**
3132 * {@link ClassNotFoundRuntimeException}を作成します。
3233 *
@@ -33,7 +34,7 @@
3334 * @param cause
3435 */
3536 public ClassNotFoundRuntimeException(ClassNotFoundException cause) {
36- this(null, cause);
37+ super(cause);
3738 }
3839
3940 /**
@@ -44,26 +45,7 @@
4445 */
4546 public ClassNotFoundRuntimeException(String className,
4647 ClassNotFoundException cause) {
47- super("ESSR0044", new Object[] { cause }, cause);
48- setClassName(className);
48+ super(className, cause);
4949 }
5050
51- /**
52- * クラス名を返します。
53- *
54- * @return
55- */
56- public String getClassName() {
57- return className;
58- }
59-
60- /**
61- * クラス名を設定します。
62- *
63- * @param className
64- * クラス名
65- */
66- protected void setClassName(String className) {
67- this.className = className;
68- }
6951 }
--- figer-s2-container/trunk/s2-framework/pom.xml (revision 30)
+++ figer-s2-container/trunk/s2-framework/pom.xml (revision 31)
@@ -113,9 +113,9 @@
113113 </dependency>
114114 <dependency>
115115 <groupId>org.slf4j</groupId>
116- <artifactId>slf4j-jcl</artifactId>
116+ <artifactId>jcl-over-slf4j</artifactId>
117117 <version>1.6.1</version>
118- <type>jar</type>
118+ <optional>true</optional>
119119 </dependency>
120120 <dependency>
121121 <groupId>org.slf4j</groupId>
@@ -125,13 +125,6 @@
125125 <optional>true</optional>
126126 </dependency>
127127 <dependency>
128- <groupId>org.slf4j</groupId>
129- <artifactId>slf4j-log4j12</artifactId>
130- <version>1.6.1</version>
131- <scope>runtime</scope>
132- <optional>true</optional>
133- </dependency>
134- <dependency>
135128 <groupId>junit</groupId>
136129 <artifactId>junit</artifactId>
137130 <version>4.8.1</version>
--- figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/DataRow.java (revision 30)
+++ figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/DataRow.java (revision 31)
@@ -18,7 +18,7 @@
1818 import org.seasar.extension.jdbc.ColumnNotFoundRuntimeException;
1919
2020 /**
21- * DataSetの業をあらわすインターフェースです。
21+ * DataSetの行をあらわすインターフェースです。
2222 *
2323 * @author higa
2424 *
--- figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataTableImpl.java (revision 30)
+++ figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataTableImpl.java (revision 31)
@@ -33,9 +33,9 @@
3333 import org.seasar.framework.beans.BeanDesc;
3434 import org.seasar.framework.beans.PropertyDesc;
3535 import org.seasar.framework.beans.factory.BeanDescFactory;
36-import org.seasar.framework.util.ArrayMap;
3736 import org.seasar.framework.util.CaseInsensitiveMap;
3837 import org.seasar.framework.util.StringUtil;
38+import org.seasar.util.collection.ArrayMap;
3939
4040 /**
4141 * {@link DataTable}の実装クラスです。
@@ -47,11 +47,11 @@
4747
4848 private String tableName;
4949
50- private List rows = new ArrayList();
50+ private List<DataRow> rows = new ArrayList<DataRow>();
5151
52- private List removedRows = new ArrayList();
52+ private List<DataRow> removedRows = new ArrayList<DataRow>();
5353
54- private ArrayMap columns = new CaseInsensitiveMap();
54+ private ArrayMap<String, DataColumn> columns = new CaseInsensitiveMap<DataColumn>();
5555
5656 private boolean hasMetaData = false;
5757
@@ -164,7 +164,7 @@
164164 column = (DataColumn) columns.get(name);
165165 if (column == null) {
166166 for (int i = 0; i < columns.size(); ++i) {
167- String key = (String) columns.getKey(i);
167+ String key = (String) columns.getKeyAt(i);
168168 String key2 = StringUtil.replace(key, "_", "");
169169 if (key2.equalsIgnoreCase(name)) {
170170 column = (DataColumn) columns.get(i);
@@ -216,8 +216,8 @@
216216 * org.seasar.extension.dataset.ColumnType)
217217 */
218218 public DataColumn addColumn(String columnName, ColumnType columnType) {
219- DataColumn column = new DataColumnImpl(columnName, columnType, columns
220- .size());
219+ DataColumn column = new DataColumnImpl(columnName, columnType,
220+ columns.size());
221221 columns.put(columnName, column);
222222 return column;
223223 }
@@ -248,9 +248,7 @@
248248 column.setWritable(true);
249249 ColumnDesc cd = (ColumnDesc) columnMap.get(column
250250 .getColumnName());
251- column
252- .setColumnType(ColumnTypes.getColumnType(cd
253- .getSqlType()));
251+ column.setColumnType(ColumnTypes.getColumnType(cd.getSqlType()));
254252 } else {
255253 column.setWritable(false);
256254 }
@@ -265,8 +263,8 @@
265263 BeanDesc beanDesc = BeanDescFactory.getBeanDesc(beanClass);
266264 for (int i = 0; i < beanDesc.getPropertyDescSize(); ++i) {
267265 PropertyDesc pd = beanDesc.getPropertyDesc(i);
268- addColumn(pd.getPropertyName(), ColumnTypes.getColumnType(pd
269- .getPropertyType()));
266+ addColumn(pd.getPropertyName(),
267+ ColumnTypes.getColumnType(pd.getPropertyType()));
270268 }
271269 }
272270
--- figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataSetImpl.java (revision 30)
+++ figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataSetImpl.java (revision 31)
@@ -18,8 +18,8 @@
1818 import org.seasar.extension.dataset.DataSet;
1919 import org.seasar.extension.dataset.DataTable;
2020 import org.seasar.extension.dataset.TableNotFoundRuntimeException;
21-import org.seasar.framework.util.ArrayMap;
2221 import org.seasar.framework.util.CaseInsensitiveMap;
22+import org.seasar.util.collection.ArrayMap;
2323
2424 /**
2525 * {@link DataSet}の実装です。
@@ -29,7 +29,7 @@
2929 */
3030 public class DataSetImpl implements DataSet {
3131
32- private ArrayMap<String, DataTable> tables = new CaseInsensitiveMap<String, DataTable>();
32+ private ArrayMap<String, DataTable> tables = new CaseInsensitiveMap<DataTable>();
3333
3434 /**
3535 * {@link DataSetImpl}を作成します。
--- figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataRowImpl.java (revision 30)
+++ figer-s2-container/trunk/s2-extension/src/main/java/org/seasar/extension/dataset/impl/DataRowImpl.java (revision 31)
@@ -15,7 +15,6 @@
1515 */
1616 package org.seasar.extension.dataset.impl;
1717
18-import java.util.Iterator;
1918 import java.util.Map;
2019
2120 import org.seasar.extension.dataset.ColumnType;
@@ -29,9 +28,9 @@
2928 import org.seasar.framework.beans.BeanDesc;
3029 import org.seasar.framework.beans.PropertyDesc;
3130 import org.seasar.framework.beans.factory.BeanDescFactory;
32-import org.seasar.framework.util.ArrayMap;
33-import org.seasar.framework.util.CaseInsensitiveMap;
3431 import org.seasar.framework.util.StringUtil;
32+import org.seasar.util.collection.ArrayMap;
33+import org.seasar.util.collection.CaseInsensitiveMap;
3534
3635 /**
3736 * {@link DataRow}の実装クラスです。
@@ -43,7 +42,7 @@
4342
4443 private DataTable table_;
4544
46- private ArrayMap values_ = new CaseInsensitiveMap();
45+ private ArrayMap<String, Object> values_ = new CaseInsensitiveMap<Object>();
4746
4847 private RowState state_ = RowStates.UNCHANGED;
4948
@@ -97,7 +96,7 @@
9796 */
9897 public void setValue(int index, Object value) {
9998 DataColumn column = table_.getColumn(index);
100- values_.set(index, column.convert(value));
99+ values_.setAt(index, column.convert(value));
101100 modify();
102101 }
103102
@@ -173,7 +172,7 @@
173172 */
174173 public void copyFrom(Object source) {
175174 if (source instanceof Map) {
176- copyFromMap((Map) source);
175+ copyFromMap((Map<String, Object>) source);
177176 } else if (source instanceof DataRow) {
178177 copyFromRow((DataRow) source);
179178 } else {
@@ -182,11 +181,11 @@
182181
183182 }
184183
185- private void copyFromMap(Map source) {
186- for (Iterator i = source.keySet().iterator(); i.hasNext();) {
187- String columnName = (String) i.next();
184+ private void copyFromMap(Map<String, Object> source) {
185+ for (Map.Entry<String, Object> entry : source.entrySet()) {
186+ String columnName = entry.getKey();
188187 if (table_.hasColumn(columnName)) {
189- Object value = source.get(columnName);
188+ Object value = entry.getValue();
190189 setValue(columnName, convertValue(value));
191190 }
192191 }
Show on old repository browser