本文整理汇总了Java中org.mybatis.generator.api.dom.java.JavaVisibility类的典型用法代码示例。如果您正苦于以下问题:Java JavaVisibility类的具体用法?Java JavaVisibility怎么用?Java JavaVisibility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaVisibility类属于org.mybatis.generator.api.dom.java包,在下文中一共展示了JavaVisibility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJavaBeansGetter
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
/**
* Gets the java beans getter.
*
* @param introspectedColumn
* the introspected column
* @param context
* the context
* @param introspectedTable
* the introspected table
* @return the java beans getter
*/
public static Method getJavaBeansGetter(IntrospectedColumn introspectedColumn,
Context context,
IntrospectedTable introspectedTable) {
FullyQualifiedJavaType fqjt = introspectedColumn
.getFullyQualifiedJavaType();
String property = introspectedColumn.getJavaProperty();
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(fqjt);
method.setName(getGetterMethodName(property, fqjt));
context.getCommentGenerator().addGetterComment(method,
introspectedTable, introspectedColumn);
StringBuilder sb = new StringBuilder();
sb.append("return "); //$NON-NLS-1$
sb.append(property);
sb.append(';');
method.addBodyLine(sb.toString());
return method;
}
示例2: getMethodShell
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
introspectedTable.getBaseRecordType());
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method
.setName(getDAOMethodNameCalculator()
.getUpdateByPrimaryKeyWithoutBLOBsMethodName(
introspectedTable));
method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
return method;
}
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:25,代码来源:UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java
示例3: getNoValueMethod
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
private Method getNoValueMethod(IntrospectedColumn introspectedColumn,
String nameFragment, String operator) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
StringBuilder sb = new StringBuilder();
sb.append(introspectedColumn.getJavaProperty());
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
sb.insert(0, "and"); //$NON-NLS-1$
sb.append(nameFragment);
method.setName(sb.toString());
method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
sb.setLength(0);
sb.append("addCriterion(\""); //$NON-NLS-1$
sb.append(Ibatis2FormattingUtilities
.getAliasedActualColumnName(introspectedColumn));
sb.append(' ');
sb.append(operator);
sb.append("\");"); //$NON-NLS-1$
method.addBodyLine(sb.toString());
method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$
return method;
}
示例4: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType type = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
importedTypes.add(type);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getDeleteByExampleStatementId());
method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientDeleteByExampleMethodGenerated(
method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例5: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
introspectedTable.getBaseRecordType());
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getUpdateByPrimaryKeyStatementId());
method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins()
.clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method,
interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:27,代码来源:UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java
示例6: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
importedTypes.add(fqjt);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
method.setName(introspectedTable.getCountByExampleStatementId());
method.addParameter(new Parameter(fqjt, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientCountByExampleMethodGenerated(method,
interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例7: getExampleMethodVisibility
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
public JavaVisibility getExampleMethodVisibility() {
if (exampleMethodVisibility == null) {
String type = context
.getJavaClientGeneratorConfiguration()
.getProperty(PropertyRegistry.DAO_EXAMPLE_METHOD_VISIBILITY);
if (stringHasValue(type)) {
if ("public".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PUBLIC;
} else if ("private".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PRIVATE;
} else if ("protected".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.PROTECTED;
} else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$
exampleMethodVisibility = JavaVisibility.DEFAULT;
} else {
exampleMethodVisibility = JavaVisibility.PUBLIC;
warnings.add(getString("Warning.16", type)); //$NON-NLS-1$
}
} else {
exampleMethodVisibility = JavaVisibility.PUBLIC;
}
}
return exampleMethodVisibility;
}
示例8: getJavaBeansField
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
/**
* Gets the java beans field.
*
* @param introspectedColumn
* the introspected column
* @param context
* the context
* @param introspectedTable
* the introspected table
* @return the java beans field
*/
public static Field getJavaBeansField(IntrospectedColumn introspectedColumn,
Context context,
IntrospectedTable introspectedTable) {
FullyQualifiedJavaType fqjt = introspectedColumn
.getFullyQualifiedJavaType();
String property = introspectedColumn.getJavaProperty();
Field field = new Field();
field.setVisibility(JavaVisibility.PRIVATE);
field.setType(fqjt);
field.setName(property);
context.getCommentGenerator().addFieldComment(field,
introspectedTable, introspectedColumn);
return field;
}
示例9: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType type = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
importedTypes.add(type);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getDeleteByExampleStatementId());
method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins().clientDeleteByExampleMethodGenerated(
method, interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例10: makeSerializable
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
protected void makeSerializable(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
if (addGWTInterface) {
topLevelClass.addImportedType(gwtSerializable);
topLevelClass.addSuperInterface(gwtSerializable);
}
if (!suppressJavaInterface) {
topLevelClass.addImportedType(serializable);
topLevelClass.addSuperInterface(serializable);
Field field = new Field();
field.setFinal(true);
field.setInitializationString("1L"); //$NON-NLS-1$
field.setName("serialVersionUID"); //$NON-NLS-1$
field.setStatic(true);
field.setType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
field.setVisibility(JavaVisibility.PRIVATE);
context.getCommentGenerator().addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
}
}
示例11: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
importedTypes.add(fqjt);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
method.setName(introspectedTable.getCountByExampleStatementId());
method.addParameter(new Parameter(fqjt, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins().clientCountByExampleMethodGenerated(method,
interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:25,代码来源:CountByExampleMethodGenerator.java
示例12: addParameterizedConstructor
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的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);
}
示例13: generateService
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
private GeneratedJavaFile generateService(IntrospectedTable table) {
// 获取实体类型
FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(table.getBaseRecordType());
// 获取主键类型
FullyQualifiedJavaType primaryType = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
// 生成 Service 名称
String service = targetPackage + "." + table.getFullyQualifiedTable().getDomainObjectName() + "Service";
// 构造 Service 文件
Interface interfaze = new Interface(new FullyQualifiedJavaType(service));
// 设置作用域
interfaze.setVisibility(JavaVisibility.PUBLIC);
// import
interfaze.addImportedType(new FullyQualifiedJavaType(baseService));
interfaze.addImportedType(entityType);
interfaze.addSuperInterface(new FullyQualifiedJavaType(
baseService + "<" + entityType.getShortName() + "," + primaryType.getShortName() + ">"));
ElementHelper.addAuthorTag(interfaze, false);
return new GeneratedJavaFile(interfaze, targetProject, new DefaultJavaFormatter());
}
示例14: addInterfaceElements
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
introspectedTable.getBaseRecordType());
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getUpdateByPrimaryKeyStatementId());
method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins()
.clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method,
interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例15: generateToString
import org.mybatis.generator.api.dom.java.JavaVisibility; //导入依赖的package包/类
private void generateToString(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getStringInstance());
method.setName("toString");
if(introspectedTable.isJava5Targeted()) {
method.addAnnotation("@Override");
}
this.context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
method.addBodyLine("StringBuilder sb = new StringBuilder();");
method.addBodyLine("sb.append(getClass().getSimpleName());");
method.addBodyLine("sb.append(\" [\");");
// method.addBodyLine("sb.append(\"Hash = \").append(hashCode());");
StringBuilder sb = new StringBuilder();
Iterator var5 = topLevelClass.getFields().iterator();
while(var5.hasNext()) {
Field field = (Field)var5.next();
String property = field.getName();
sb.setLength(0);
sb.append("sb.append(\"").append(", ").append(property).append("=\")").append(".append(").append(property).append(");");
method.addBodyLine(sb.toString());
}
method.addBodyLine("sb.append(\"]\");");
// if(this.useToStringFromRoot && topLevelClass.getSuperClass() != null) {
// method.addBodyLine("sb.append(\", from super class \");");
// method.addBodyLine("sb.append(super.toString());");
// }
method.addBodyLine("return sb.toString();");
topLevelClass.addMethod(method);
}