本文整理了Java中org.mybatis.generator.api.dom.java.Method.getAnnotations()
方法的一些代码示例,展示了Method.getAnnotations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.getAnnotations()
方法的具体详情如下:
包路径:org.mybatis.generator.api.dom.java.Method
类名称:Method
方法名:getAnnotations
暂无
代码示例来源:origin: dcendents/mybatis-generator-plugins
void renameResultMapAttribute(Method method, IntrospectedTable introspectedTable) {
if (tableMatches(introspectedTable)) {
List<String> annotations = method.getAnnotations();
for (int i = 0; i < annotations.size(); i++) {
String annotation = annotations.get(i);
if (ANNOTATION_PATTERN.matcher(annotation).matches()) {
String newAnnotation = String.format(ANNOTATION_FORMAT, resultMapId);
annotations.remove(i);
annotations.add(newAnnotation);
break;
}
}
}
}
代码示例来源:origin: dcendents/mybatis-generator-plugins
Method addMethod(Method method, IntrospectedTable introspectedTable) {
IntrospectedColumn column = getColumn(introspectedTable);
Method withLock = new Method(method);
withLock.setName(method.getName() + METHOD_SUFFIX);
withLock.getAnnotations().clear();
for (String line : method.getAnnotations()) {
if (line.matches("\\s*\".*\"\\s*")) {
withLock.getAnnotations().add(line + ",");
String typeHandler = column.getTypeHandler() != null ? String.format(",typeHandler=%s", column.getTypeHandler()) : "";
withLock.getAnnotations().add(String.format(" \"and %1$s = #{%2$s,jdbcType=%3$s%4$s}\"", lockColumnFunction,
column.getJavaProperty(), column.getJdbcTypeName(), typeHandler));
} else {
withLock.getAnnotations().add(line);
}
}
return withLock;
}
代码示例来源:origin: org.mybatis.generator/mybatis-generator-core
private void copyAndAddSelectManyMethod(Method method, Interface interfaze) {
List<String> annotations = new ArrayList<String>(method.getAnnotations());
newMethod.getAnnotations().clear();
for (String annotation : annotations) {
newMethod.addAnnotation(annotation);
代码示例来源:origin: io.github.cgi/mybatis-generator-plugins
List<String> annotations = m.getAnnotations();
Iterator<String> it = annotations.iterator();
while (it.hasNext()) {
代码示例来源:origin: dcendents/mybatis-generator-plugins
/**
* Rename the method types.
*
* @param method
* the method
* @return true
*/
boolean renameMethod(Method method) {
method.setReturnType(modelProperties.renameType(method.getReturnType()));
for (int i = 0; i < method.getParameters().size(); i++) {
Parameter parameter = method.getParameters().get(i);
FullyQualifiedJavaType parameterType = parameter.getType();
FullyQualifiedJavaType newParameterType = modelProperties.renameType(parameterType);
if (parameterType != newParameterType) {
Parameter newParam = new Parameter(newParameterType, parameter.getName(), parameter.isVarargs());
for (String annotation : parameter.getAnnotations()) {
newParam.addAnnotation(annotation);
}
method.getParameters().set(i, newParam);
log.debug("set new parameter: [{}][{}]", parameter, newParam);
}
}
modelProperties.renameAnnotations(method.getAnnotations());
mapperProperties.renameAnnotations(method.getAnnotations());
return true;
}
代码示例来源:origin: io.github.cgi/mybatis-generator-plugins
private Method generateDecoratedMapperMethod(Method method, IntrospectedTable introspectedTable) {
Method methodToGenerate = new Method(config.methodToGenerateName);
methodToGenerate.setVisibility(method.getVisibility());
methodToGenerate.setReturnType(method.getReturnType());
context.getCommentGenerator().addGeneralMethodComment(methodToGenerate, introspectedTable);
List<String> annotations = method.getAnnotations();
for (String a : annotations) {
if (a.matches("@.*Provider.*")) {
methodToGenerate.addAnnotation(a.replace(config.methodToDecorateName, config.methodToGenerateName));
} else
methodToGenerate.addAnnotation(a);
}
List<Parameter> params = method.getParameters();
for (Parameter p : params) {
methodToGenerate.addParameter(p);
}
return methodToGenerate;
}
代码示例来源:origin: io.github.cgi/mybatis-generator-plugins
private Method generateSelectOneByExample(Method method, IntrospectedTable introspectedTable) {
Method m = new Method(config.methodToGenerate);
m.setVisibility(method.getVisibility());
FullyQualifiedJavaType returnType = introspectedTable.getRules().calculateAllFieldsClass();
m.setReturnType(returnType);
List<String> annotations = method.getAnnotations();
for (String a : annotations) {
m.addAnnotation(a);
}
List<Parameter> params = method.getParameters();
for (Parameter p : params) {
m.addParameter(p);
}
context.getCommentGenerator().addGeneralMethodComment(m, introspectedTable);
return m;
}
内容来源于网络,如有侵权,请联系作者删除!