汎用的な自分で作った例
1908 ワード
[quote]
CallManは呼び出しをして、少しjdbcTemplateのモードをまねて、クライアントが返すデータのフォーマットのタイプを決定します
[/quote]
[code]
package com.ssc.dbcttool.generic;
public interface Nail {
T makeDamageBean(String A , String B);
}
[/code]
[code]
package com.ssc.dbcttool.generic;
public class Fire implements Nail{
@Override
public T makeDamageBean(String A, String B) {
return null;
}
}
[/code]
[code]
package com.ssc.dbcttool.generic;
public class HarmBean {
}
[/code]
CallManは呼び出しをして、少しjdbcTemplateのモードをまねて、クライアントが返すデータのフォーマットのタイプを決定します
[/quote]
package com.ssc.dbcttool.generic;
import org.junit.Test;
public class CallMan {
InterfacePlatform ip = new InterfacePlatform();
@Test
public void testPlatform(){
Nail nail = new Fire();
HarmBean hb = ip.entryMethod("action", nail);
System.out.println(hb);
}
}
package com.ssc.dbcttool.generic;
public class InterfacePlatform {
RequiedResource rs;
Tool tool = new Tool();
public void init(){
tool = new Tool(rs);
}
public T entryMethod(String action, Nail beanClass){
tool.actionPrepare(action);
T b = tool.doAction(beanClass);
return b;
}
}
package com.ssc.dbcttool.generic;
public class Tool {
private ThreadLocal nail;
public Tool(){}
public Tool(RequiedResource rs) {
// TODO Auto-generated constructor stub
}
public Tool actionPrepare(String action) {
return this;
}
public T doAction(Nail nail) {
return nail.makeDamageBean("aaa", "bbb");
}
}
[code]
package com.ssc.dbcttool.generic;
public interface Nail {
T makeDamageBean(String A , String B);
}
[/code]
[code]
package com.ssc.dbcttool.generic;
public class Fire implements Nail{
@Override
public T makeDamageBean(String A, String B) {
return null;
}
}
[/code]
[code]
package com.ssc.dbcttool.generic;
public class HarmBean {
}
[/code]