本文整理汇总了Java中org.mybatis.generator.api.dom.java.Method.setConstructor方法的典型用法代码示例。如果您正苦于以下问题:Java Method.setConstructor方法的具体用法?Java Method.setConstructor怎么用?Java Method.setConstructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mybatis.generator.api.dom.java.Method
的用法示例。
在下文中一共展示了Method.setConstructor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConstructorClone
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
* Gets the constructor clone.
*
* @param commentGenerator
* the comment generator
* @param type
* the type
* @param introspectedTable
* the introspected table
* @return the constructor clone
*/
public final Method getConstructorClone(CommentGenerator commentGenerator,
FullyQualifiedJavaType type, IntrospectedTable introspectedTable) {
configure();
Method answer = new Method();
answer.setConstructor(true);
answer.setName(type.getShortName());
answer.setVisibility(constructorTemplate.getVisibility());
for (Parameter parm : constructorTemplate.getParameters()) {
answer.addParameter(parm);
}
for (String bodyLine : constructorTemplate.getBodyLines()) {
answer.addBodyLine(bodyLine);
}
for (FullyQualifiedJavaType fqjt : constructorTemplate.getExceptions()) {
answer.addException(fqjt);
}
commentGenerator.addGeneralMethodComment(answer, introspectedTable);
return answer;
}
示例2: addParameterizedConstructor
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private void addParameterizedConstructor(TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setConstructor(true);
method.setName(topLevelClass.getType().getShortName());
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
StringBuilder sb = new StringBuilder();
for (IntrospectedColumn introspectedColumn : introspectedTable
.getPrimaryKeyColumns()) {
method.addParameter(new Parameter(introspectedColumn.getFullyQualifiedJavaType(),
introspectedColumn.getJavaProperty()));
sb.setLength(0);
sb.append("this."); //$NON-NLS-1$
sb.append(introspectedColumn.getJavaProperty());
sb.append(" = "); //$NON-NLS-1$
sb.append(introspectedColumn.getJavaProperty());
sb.append(';');
method.addBodyLine(sb.toString());
}
topLevelClass.addMethod(method);
}
示例3: configureConstructorTemplate
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
Method method = new Method();
method.setConstructor(true);
method.setVisibility(JavaVisibility.PUBLIC);
method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$
method.addBodyLine("super(daoManager);"); //$NON-NLS-1$
setConstructorTemplate(method);
}
示例4: configureConstructorTemplate
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
Method constructor = new Method();
constructor.setConstructor(true);
constructor.setVisibility(JavaVisibility.PUBLIC);
constructor
.addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$
constructor.addBodyLine("super();"); //$NON-NLS-1$
constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$
setConstructorTemplate(constructor);
}
示例5: getMethodClones
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
* Gets the method clones.
*
* @param commentGenerator
* the comment generator
* @param introspectedTable
* the introspected table
* @return the method clones
*/
public final List<Method> getMethodClones(
CommentGenerator commentGenerator,
IntrospectedTable introspectedTable) {
configure();
List<Method> answer = new ArrayList<Method>();
for (Method oldMethod : methods) {
Method method = new Method();
for (String bodyLine : oldMethod.getBodyLines()) {
method.addBodyLine(bodyLine);
}
for (FullyQualifiedJavaType fqjt : oldMethod.getExceptions()) {
method.addException(fqjt);
}
for (Parameter parm : oldMethod.getParameters()) {
method.addParameter(parm);
}
method.setConstructor(oldMethod.isConstructor());
method.setFinal(oldMethod.isFinal());
method.setStatic(oldMethod.isStatic());
method.setName(oldMethod.getName());
method.setReturnType(oldMethod.getReturnType());
method.setVisibility(oldMethod.getVisibility());
commentGenerator.addGeneralMethodComment(method, introspectedTable);
answer.add(method);
}
return answer;
}
示例6: configureConstructorTemplate
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
Method method = new Method();
method.setConstructor(true);
method.setVisibility(JavaVisibility.PUBLIC);
method.addBodyLine("super();"); //$NON-NLS-1$
setConstructorTemplate(method);
}
示例7: addDefaultConstructor
import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
protected void addDefaultConstructor(TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setConstructor(true);
method.setName(topLevelClass.getType().getShortName());
method.addBodyLine("super();"); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
}