public class EndpointApiCtClassBuilder extends CtClassBuilder
classFile, declaring, pool| 构造器和说明 |
|---|
EndpointApiCtClassBuilder(javassist.ClassPool pool,
String classname) |
EndpointApiCtClassBuilder(String classname) |
| 限定符和类型 | 方法和说明 |
|---|---|
EndpointApiCtClassBuilder |
api(String... tags)
添加类注解 @Api
|
EndpointApiCtClassBuilder |
apiIgnore()
添加类注解 @ApiIgnore
|
<T> EndpointApiCtClassBuilder |
autowired(Class<T> type,
String name,
boolean required)
添加字段注解 @Autowired 实现对象注入
|
<T> CtClassBuilder |
autowired(Class<T> type,
String name,
boolean required,
String qualifier)
添加字段注解 @Autowired @Qualifier 实现对象注入
|
EndpointApiCtClassBuilder |
autowiredHandler(boolean required,
String qualifier)
添加字段注解 @Autowired 实现对象注入
|
EndpointApiCtClassBuilder |
bind(MvcBound bound)
通过给动态类增加
@WebBound注解实现,数据的绑定 |
EndpointApiCtClassBuilder |
bind(String uid,
String json)
通过给动态类增加
@WebBound注解实现,数据的绑定 |
EndpointApiCtClassBuilder |
controller()
添加类注解 @Controller
|
EndpointApiCtClassBuilder |
controller(String name)
添加类注解 @Controller
|
EndpointApiCtClassBuilder |
makeField(String src)
Compiles the given source code and creates a field.
|
EndpointApiCtClassBuilder |
makeMethod(String src)
Compiles the given source code and creates a method.
|
<T> EndpointApiCtClassBuilder |
newField(Class<T> fieldClass,
String fieldName,
String fieldValue) |
<T> EndpointApiCtClassBuilder |
newMethod(Class<T> rtClass,
MvcMethod method,
MvcBound bound,
MvcParam<?>... params)
根据参数构造一个新的方法
|
EndpointApiCtClassBuilder |
newMethod(String methodName,
String path,
org.springframework.web.bind.annotation.RequestMethod method,
String contentType,
MvcBound bound,
MvcParam<?>... params) |
EndpointApiCtClassBuilder |
removeField(String fieldName) |
<T> EndpointApiCtClassBuilder |
removeMethod(String methodName,
MvcParam<?>... params) |
EndpointApiCtClassBuilder |
requestMapping(MvcMapping mapping)
添加类注解 @RequestMapping
|
EndpointApiCtClassBuilder |
requestMapping(String path)
添加类注解 @RequestMapping
|
EndpointApiCtClassBuilder |
requestMapping(String name,
String[] path,
org.springframework.web.bind.annotation.RequestMethod[] method,
String[] params,
String[] headers,
String[] consumes,
String[] produces)
添加类注解 @RequestMapping
|
EndpointApiCtClassBuilder |
restController()
添加类注解 @RestController
|
EndpointApiCtClassBuilder |
restController(String name)
添加类注解 @RestController
|
build, toClass, toInstancepublic EndpointApiCtClassBuilder(String classname) throws javassist.CannotCompileException, javassist.NotFoundException
javassist.CannotCompileExceptionjavassist.NotFoundExceptionpublic EndpointApiCtClassBuilder(javassist.ClassPool pool,
String classname)
throws javassist.CannotCompileException,
javassist.NotFoundException
javassist.CannotCompileExceptionjavassist.NotFoundExceptionpublic <T> EndpointApiCtClassBuilder autowired(Class<T> type, String name, boolean required) throws javassist.CannotCompileException, javassist.NotFoundException
CtClassBuilderautowired 在类中 CtClassBuilderT - : 参数泛型type - : The type attribute value of @Autowiredname - : The name attribute value of @Autowiredrequired - : Declares whether the annotated dependency is required.CtClassBuilder instancejavassist.CannotCompileException - if can't compilejavassist.NotFoundException - if not foundpublic EndpointApiCtClassBuilder autowiredHandler(boolean required, String qualifier) throws javassist.CannotCompileException, javassist.NotFoundException
CtClassBuilderautowiredHandler 在类中 CtClassBuilderrequired - : Declares whether the annotated dependency is required.qualifier - : The qualifier attribute value of @AutowiredCtClassBuilder instancejavassist.CannotCompileException - if can't compilejavassist.NotFoundException - if not foundpublic <T> CtClassBuilder autowired(Class<T> type, String name, boolean required, String qualifier) throws javassist.CannotCompileException, javassist.NotFoundException
CtClassBuilderautowired 在类中 CtClassBuilderT - : 参数泛型type - : The type attribute value of @Autowiredname - : The name attribute value of @Autowiredrequired - : Declares whether the annotated dependency is required.qualifier - : The qualifier attribute value of @AutowiredCtClassBuilder instancejavassist.CannotCompileException - if can't compilejavassist.NotFoundException - if not foundpublic EndpointApiCtClassBuilder bind(MvcBound bound)
CtClassBuilder@WebBound注解实现,数据的绑定bind 在类中 CtClassBuilderbound - : The MvcBound instanceCtClassBuilder instancepublic EndpointApiCtClassBuilder bind(String uid, String json)
CtClassBuilder@WebBound注解实现,数据的绑定bind 在类中 CtClassBuilderuid - : The value of uidjson - : The value of jsonCtClassBuilder instancepublic EndpointApiCtClassBuilder makeField(String src) throws javassist.CannotCompileException
CtClassBuilder"public String name;" "public int k = 3;"
Note that the source code ends with ';'
(semicolon).
makeField 在类中 CtClassBuildersrc - the source text.CtClassBuilder instancejavassist.CannotCompileException - if can't compilepublic EndpointApiCtClassBuilder makeMethod(String src) throws javassist.CannotCompileException
CtClassBuilder"public Object id(Object obj) { return obj; }"makeMethod 在类中 CtClassBuildersrc - the source text.CtClassBuilder instancejavassist.CannotCompileException - if can't compilepublic <T> EndpointApiCtClassBuilder newField(Class<T> fieldClass, String fieldName, String fieldValue) throws javassist.CannotCompileException, javassist.NotFoundException
newField 在类中 CtClassBuilderjavassist.CannotCompileExceptionjavassist.NotFoundExceptionpublic EndpointApiCtClassBuilder removeField(String fieldName) throws javassist.NotFoundException
removeField 在类中 CtClassBuilderjavassist.NotFoundExceptionpublic EndpointApiCtClassBuilder api(String... tags)
tags - 标签名称EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder apiIgnore()
EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder controller()
EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder controller(String name)
name - Controller名称:必须唯一EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder restController()
EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder restController(String name)
name - Controller名称:必须唯一EndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder requestMapping(MvcMapping mapping)
mapping - : The MvcMapping instanceEndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder requestMapping(String path)
path - : The path attribute values of @RequestMappingEndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder requestMapping(String name, String[] path, org.springframework.web.bind.annotation.RequestMethod[] method, String[] params, String[] headers, String[] consumes, String[] produces)
name - : The name attribute value of @RequestMappingpath - : The path attribute values of @RequestMappingmethod - : The method attribute values of @RequestMappingparams - : The params attribute values of @RequestMappingheaders - : The headers attribute values of @RequestMappingconsumes - : The consumes attribute values of @RequestMappingproduces - : The produces attribute values of @RequestMappingEndpointApiCtClassBuilder instancepublic EndpointApiCtClassBuilder newMethod(String methodName, String path, org.springframework.web.bind.annotation.RequestMethod method, String contentType, MvcBound bound, MvcParam<?>... params) throws javassist.CannotCompileException, javassist.NotFoundException
methodName - : 方法名称path - : 发布地址method - : 请求方式(GET/POST)contentType - : 响应类型及编码bound - :数据绑定对象params - :参数信息EndpointApiCtClassBuilder instancejavassist.CannotCompileException - if can't compilejavassist.NotFoundException - if not foundpublic <T> EndpointApiCtClassBuilder newMethod(Class<T> rtClass, MvcMethod method, MvcBound bound, MvcParam<?>... params) throws javassist.CannotCompileException, javassist.NotFoundException
T - : 参数泛型rtClass - :返回对象类型method - :方法注释信息bound - :方法绑定数据信息params - : 参数信息EndpointApiCtClassBuilder instancejavassist.CannotCompileException - if can't compilejavassist.NotFoundException - if not foundpublic <T> EndpointApiCtClassBuilder removeMethod(String methodName, MvcParam<?>... params) throws javassist.NotFoundException
javassist.NotFoundExceptionCopyright © 2019. All rights reserved.