public abstract class AbstractAdaptor extends Object implements HttpAdaptor
限定符和类型 | 字段和说明 |
---|---|
protected Class<?>[] |
argTypes |
protected String[] |
defaultValues |
protected ParamInjector[] |
injs |
protected Method |
method |
static String |
ParamDefailtTag |
构造器和说明 |
---|
AbstractAdaptor() |
限定符和类型 | 方法和说明 |
---|---|
Object[] |
adapt(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String[] pathArgs)
你的适配器需要根据传入的 request 和 response 生成函数的调用参数
|
protected ParamInjector |
evalInjector(Type type,
Param param) |
protected abstract ParamInjector |
evalInjectorBy(Type type,
Param param)
子类实现这个方法根据自己具体的逻辑来生产一个参数注入器
|
protected Object |
getReferObject(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String[] pathArgs) |
void |
init(Method method)
这个函数将在你的适配器生命周期内,这个函数将只被调用一次。
|
protected ParamInjector |
paramNameInject(Method method,
int index)
这是最后的大招了,查一下形参的名字,作为@Param("形参名")进行处理
|
protected ParamInjector[] injs
protected Method method
protected Class<?>[] argTypes
protected String[] defaultValues
public void init(Method method)
HttpAdaptor
init
在接口中 HttpAdaptor
method
- 你需要适配的方法protected ParamInjector evalInjector(Type type, Param param)
protected abstract ParamInjector evalInjectorBy(Type type, Param param)
type
- 参数类型param
- 参数的注解public Object[] adapt(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String[] pathArgs)
HttpAdaptor
adapt
在接口中 HttpAdaptor
sc
- Servlet 上下文对象req
- 请求对象resp
- 响应对象pathArgs
- 字符串数组,路径参数。详情请参看 路径参数protected Object getReferObject(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String[] pathArgs)
protected ParamInjector paramNameInject(Method method, int index)
Copyright © 2017. All rights reserved.