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

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


    Method method = new Method();
    method.setVisibility(getExampleMethodVisibility());
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(getDAOMethodNameCalculator().getUpdateByExampleWithoutBLOBsMethodName(introspectedTable));
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
    method.addParameter(new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
      method.addException(fqjt);
      importedTypes.add(fqjt);
    }
View Full Code Here


    method.setName(methodNameCalculator.getInsertMethodName(introspectedTable));

    FullyQualifiedJavaType parameterType = introspectedTable.getRules().calculateAllFieldsClass();

    importedTypes.add(parameterType);
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
      method.addException(fqjt);
      importedTypes.add(fqjt);
    }
View Full Code Here

    Method method = new Method();
    method.setConstructor(true);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName(innerClass.getType().getShortName());
    method.addParameter(new Parameter(FullyQualifiedJavaType.getObjectInstance(), "record")); //$NON-NLS-1$
    method.addParameter(new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example")); //$NON-NLS-1$
    method.addBodyLine("super(example);"); //$NON-NLS-1$
    method.addBodyLine("this.record = record;"); //$NON-NLS-1$
    innerClass.addMethod(method);

    Field field = new Field();
View Full Code Here

    Method method = new Method();
    method.setVisibility(getExampleMethodVisibility());
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(getDAOMethodNameCalculator().getUpdateByExampleSelectiveMethodName(introspectedTable));
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
    method.addParameter(new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example")); //$NON-NLS-1$

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
      method.addException(fqjt);
      importedTypes.add(fqjt);
    }
View Full Code Here

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

    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();
    // method.addBodyLine("try {");
View Full Code Here

   */
  protected Method countByExample(IntrospectedTable introspectedTable, String tableName) {
    Method method = new Method();
    method.setName("countByExample");
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.addParameter(new Parameter(pojoCriteriaType, "example"));
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append("int count = this.");
    sb.append(getDaoShort());
    sb.append("countByExample");
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());
    if (introspectedTable.hasBLOBColumns()) {
View Full Code Here

   */
  protected Method getOtherInsertboolean(String methodName, IntrospectedTable introspectedTable, String tableName) {
    Method method = new Method();
    method.setName(methodName);
    method.setReturnType(returnType);
    method.addParameter(new Parameter(pojoType, "record"));
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    if (returnType==null) {
      sb.append("this.");
    } else {
View Full Code Here

   * type ηš„ζ„δΉ‰ pojo 1 key 2 example 3 pojo+example 4
   */
  protected String addParams(IntrospectedTable introspectedTable, Method method, int type1) {
    switch (type1) {
    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()) {
        sb.append(introspectedColumn.getJavaProperty());
        sb.append(",");
      }
      sb.setLength(sb.length() - 1);
      return sb.toString();
    case 3:
      method.addParameter(new Parameter(pojoCriteriaType, "example"));
      return "example";
    case 4:

      method.addParameter(0, new Parameter(pojoType, "record"));
      method.addParameter(1, new Parameter(pojoCriteriaType, "example"));
//      if(method.getName().equals("updateByExampleSelective")||method.getName().equals("updateByExample")){
//        return "record, example.getCondition()";
//      }
      return "record, example";
    default:
View Full Code Here

TOP

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

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.