Package org.mybatis.generator.api.dom.java

Examples of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType


      interfaze.addMethod(method);
    }
  }

  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());
View Full Code Here


  private boolean enableUpdateByPrimaryKeySelective = false;

  public MybatisServicePlugin() {
    super();
    // 默认是slf4j
    slf4jLogger = new FullyQualifiedJavaType("org.slf4j.Logger");
    slf4jLoggerFactory = new FullyQualifiedJavaType("org.slf4j.LoggerFactory");
    methods = new ArrayList<Method>();
  }
View Full Code Here

    project = properties.getProperty("targetProject");

    pojoUrl = context.getJavaModelGeneratorConfiguration().getTargetPackage();

    if (enableAnnotation) {
      autowired = new FullyQualifiedJavaType("org.springframework.beans.factory.annotation.Autowired");
      service = new FullyQualifiedJavaType("org.springframework.stereotype.Service");
    }
    return true;
  }
View Full Code Here

  @Override
  public List<GeneratedJavaFile> contextGenerateAdditionalJavaFiles(IntrospectedTable introspectedTable) {
    List<GeneratedJavaFile> files = new ArrayList<GeneratedJavaFile>();
    String table = introspectedTable.getBaseRecordType();
    String tableName = table.replaceAll(this.pojoUrl + ".", "");
    interfaceType = new FullyQualifiedJavaType(servicePack + "." + tableName + "Service");

    // mybatis
    daoType = new FullyQualifiedJavaType(introspectedTable.getMyBatis3JavaMapperType());

    // logger.info(toLowerCase(daoType.getShortName()));
    serviceType = new FullyQualifiedJavaType(serviceImplPack + "." + tableName + "ServiceImpl");

    pojoType = new FullyQualifiedJavaType(pojoUrl + "." + tableName);

    pojoCriteriaType = new FullyQualifiedJavaType(pojoUrl + "." + tableName + "Example");
    listType = new FullyQualifiedJavaType("java.util.List");
    Interface interface1 = new Interface(interfaceType);
    TopLevelClass topLevelClass = new TopLevelClass(serviceType);
    // 导入必要的类
    addImport(interface1, topLevelClass);
View Full Code Here

  protected Method selectByPrimaryKey(IntrospectedTable introspectedTable, String tableName) {
    Method method = new Method();
    method.setName("selectByPrimaryKey");
    method.setReturnType(pojoType);
    if (introspectedTable.getRules().generatePrimaryKeyClass()) {
      FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getPrimaryKeyType());
      method.addParameter(new Parameter(type, "key"));
    } else {
      for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
        FullyQualifiedJavaType type = introspectedColumn.getFullyQualifiedJavaType();
        method.addParameter(new Parameter(type, introspectedColumn.getJavaProperty()));
      }
    }
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
View Full Code Here

   *
   */
  protected Method selectByExample(IntrospectedTable introspectedTable, String tableName) {
    Method method = new Method();
    method.setName("selectByExample");
    method.setReturnType(new FullyQualifiedJavaType("List<" + tableName + ">"));
    method.addParameter(new Parameter(pojoCriteriaType, "example"));
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append("return this.");
    sb.append(getDaoShort());
View Full Code Here

    case 1:
      method.addParameter(new Parameter(pojoType, "record"));
      return "record";
    case 2:
      if (introspectedTable.getRules().generatePrimaryKeyClass()) {
        FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getPrimaryKeyType());
        method.addParameter(new Parameter(type, "key"));
      } else {
        for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
          FullyQualifiedJavaType type = introspectedColumn.getFullyQualifiedJavaType();
          method.addParameter(new Parameter(type, introspectedColumn.getJavaProperty()));
        }
      }
      StringBuffer sb = new StringBuffer();
      for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
View Full Code Here

    Field field = new Field();
    field.setFinal(true);
    field.setInitializationString("LoggerFactory.getLogger(" + topLevelClass.getType().getShortName() + ".class)"); // 设置值
    field.setName("logger"); // 设置变量名
    field.setStatic(true);
    field.setType(new FullyQualifiedJavaType("Logger")); // 类型
    field.setVisibility(JavaVisibility.PRIVATE);
    topLevelClass.addField(field);
  }
View Full Code Here

  private FullyQualifiedJavaType serializable;

  public SerializablePlugin() {
    super();
    serializable = new FullyQualifiedJavaType("java.io.Serializable"); //$NON-NLS-1$

  }
View Full Code Here

    field.setFinal(true);
    Long temp=Long.valueOf(RandomStringUtils.randomNumeric(18));
    field.setInitializationString(temp+"L"); //$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(0, field);
  }
View Full Code Here

TOP

Related Classes of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.