本文整理汇总了Java中org.mybatis.generator.api.dom.java.FullyQualifiedJavaType.isPrimitive方法的典型用法代码示例。如果您正苦于以下问题:Java FullyQualifiedJavaType.isPrimitive方法的具体用法?Java FullyQualifiedJavaType.isPrimitive怎么用?Java FullyQualifiedJavaType.isPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mybatis.generator.api.dom.java.FullyQualifiedJavaType
的用法示例。
在下文中一共展示了FullyQualifiedJavaType.isPrimitive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImplementationElements
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; //导入方法依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
FullyQualifiedJavaType returnType = method.getReturnType();
StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append("Object newKey = "); //$NON-NLS-1$
}
sb.append(daoTemplate.getInsertMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getInsertStatementId(), "record")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
if (returnType != null) {
if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
// no need to cast if the return type is Object
method.addBodyLine("return newKey;"); //$NON-NLS-1$
} else {
sb.setLength(0);
if (returnType.isPrimitive()) {
PrimitiveTypeWrapper ptw = returnType
.getPrimitiveTypeWrapper();
sb.append("return (("); //$NON-NLS-1$
sb.append(ptw.getShortName());
sb.append(") newKey"); //$NON-NLS-1$
sb.append(")."); //$NON-NLS-1$
sb.append(ptw.getToPrimitiveMethod());
sb.append(';');
} else {
sb.append("return ("); //$NON-NLS-1$
sb.append(returnType.getShortName());
sb.append(") newKey;"); //$NON-NLS-1$
}
method.addBodyLine(sb.toString());
}
}
if (context.getPlugins().clientInsertMethodGenerated(method,
topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例2: addImplementationElements
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; //导入方法依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
FullyQualifiedJavaType returnType = method.getReturnType();
StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append("Object newKey = "); //$NON-NLS-1$
}
sb.append(daoTemplate.getInsertMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getInsertSelectiveStatementId(), "record")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
if (returnType != null) {
if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
// no need to cast if the return type is Object
method.addBodyLine("return newKey;"); //$NON-NLS-1$
} else {
sb.setLength(0);
if (returnType.isPrimitive()) {
PrimitiveTypeWrapper ptw = returnType
.getPrimitiveTypeWrapper();
sb.append("return (("); //$NON-NLS-1$
sb.append(ptw.getShortName());
sb.append(") newKey"); //$NON-NLS-1$
sb.append(")."); //$NON-NLS-1$
sb.append(ptw.getToPrimitiveMethod());
sb.append(';');
} else {
sb.append("return ("); //$NON-NLS-1$
sb.append(returnType.getShortName());
sb.append(") newKey;"); //$NON-NLS-1$
}
method.addBodyLine(sb.toString());
}
}
if (context.getPlugins().clientInsertSelectiveMethodGenerated(
method, topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例3: addImplementationElements
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; //导入方法依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (generateForJava5) {
method.addAnnotation("@Override"); //$NON-NLS-1$
}
FullyQualifiedJavaType returnType = method.getReturnType();
StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append("Object newKey = "); //$NON-NLS-1$
}
sb.append(daoTemplate.getInsertMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getInsertStatementId(), "record")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
if (returnType != null) {
if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
// no need to cast if the return type is Object
method.addBodyLine("return newKey;"); //$NON-NLS-1$
} else {
sb.setLength(0);
if (returnType.isPrimitive()) {
PrimitiveTypeWrapper ptw = returnType
.getPrimitiveTypeWrapper();
sb.append("return (("); //$NON-NLS-1$
sb.append(ptw.getShortName());
sb.append(") newKey"); //$NON-NLS-1$
sb.append(")."); //$NON-NLS-1$
sb.append(ptw.getToPrimitiveMethod());
sb.append(';');
} else {
sb.append("return ("); //$NON-NLS-1$
sb.append(returnType.getShortName());
sb.append(") newKey;"); //$NON-NLS-1$
}
method.addBodyLine(sb.toString());
}
}
if (context.getPlugins().clientInsertMethodGenerated(method,
topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例4: addImplementationElements
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; //导入方法依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (generateForJava5) {
method.addAnnotation("@Override"); //$NON-NLS-1$
}
FullyQualifiedJavaType returnType = method.getReturnType();
StringBuilder sb = new StringBuilder();
if (returnType != null) {
sb.append("Object newKey = "); //$NON-NLS-1$
}
sb.append(daoTemplate.getInsertMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getInsertSelectiveStatementId(), "record")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
if (returnType != null) {
if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
// no need to cast if the return type is Object
method.addBodyLine("return newKey;"); //$NON-NLS-1$
} else {
sb.setLength(0);
if (returnType.isPrimitive()) {
PrimitiveTypeWrapper ptw = returnType
.getPrimitiveTypeWrapper();
sb.append("return (("); //$NON-NLS-1$
sb.append(ptw.getShortName());
sb.append(") newKey"); //$NON-NLS-1$
sb.append(")."); //$NON-NLS-1$
sb.append(ptw.getToPrimitiveMethod());
sb.append(';');
} else {
sb.append("return ("); //$NON-NLS-1$
sb.append(returnType.getShortName());
sb.append(") newKey;"); //$NON-NLS-1$
}
method.addBodyLine(sb.toString());
}
}
if (context.getPlugins().clientInsertSelectiveMethodGenerated(
method, topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}