1 |
|
package com.wikihouse.wildcats0201.jdbcchart; |
2 |
|
|
3 |
|
import java.sql.Connection; |
4 |
|
|
5 |
|
import org.jfree.data.general.Dataset; |
6 |
|
|
7 |
|
import com.wikihouse.wildcats0201.jdbcchart.reflectionutil.ClassWrapper; |
8 |
|
import com.wikihouse.wildcats0201.jdbcchart.reflectionutil.ConstructorWrapper; |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
public final class DatasetFactory { |
18 |
|
|
19 |
0 |
private DatasetFactory() { |
20 |
0 |
} |
21 |
|
|
22 |
|
public static Dataset create(String className, Connection conn, String sql) { |
23 |
0 |
ClassWrapper clazz = new ClassWrapper(className); |
24 |
0 |
ConstructorWrapper constructor = clazz.getConstructor(new Class[] { |
25 |
0 |
Connection.class, String.class }); |
26 |
0 |
return (Dataset) constructor.newInstance(new Object[] { conn, sql }); |
27 |
|
} |
28 |
|
|
29 |
|
} |