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

Examples of org.mybatis.generator.api.dom.java.InnerClass.addMethod()


      }

      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("return allCriteria;"); //$NON-NLS-1$
    }
    answer.addMethod(method);

    // now we need to generate the methods that will be used in the SqlMap
    // to generate the dynamic where clause
    topLevelClass.addImportedType(FullyQualifiedJavaType.getNewListInstance());
    topLevelClass.addImportedType(FullyQualifiedJavaType.getNewArrayListInstance());
View Full Code Here


    method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(field.getType());
    method.setName(getGetterMethodName(field.getName(), field.getType()));
    method.addBodyLine("return criteria;"); //$NON-NLS-1$
    answer.addMethod(method);

    // now add the methods for simplifying the individual field set methods
    method = new Method();
    method.setVisibility(JavaVisibility.PROTECTED);
    method.setName("addCriterion"); //$NON-NLS-1$
View Full Code Here

    method.addBodyLine("}"); //$NON-NLS-1$
    method.addBodyLine("criteria.add(new Criterion(condition));"); //$NON-NLS-1$
    if (criteriaLists.size() > 1) {
      method.addBodyLine("allCriteria = null;"); //$NON-NLS-1$
    }
    answer.addMethod(method);

    method = new Method();
    method.setVisibility(JavaVisibility.PROTECTED);
    method.setName("addCriterion"); //$NON-NLS-1$
    method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

    method.addBodyLine("}"); //$NON-NLS-1$
    method.addBodyLine("criteria.add(new Criterion(condition, value));"); //$NON-NLS-1$
    if (criteriaLists.size() > 1) {
      method.addBodyLine("allCriteria = null;"); //$NON-NLS-1$
    }
    answer.addMethod(method);

    method = new Method();
    method.setVisibility(JavaVisibility.PROTECTED);
    method.setName("addCriterion"); //$NON-NLS-1$
    method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

    method.addBodyLine("}"); //$NON-NLS-1$
    method.addBodyLine("criteria.add(new Criterion(condition, value1, value2));"); //$NON-NLS-1$
    if (criteriaLists.size() > 1) {
      method.addBodyLine("allCriteria = null;"); //$NON-NLS-1$
    }
    answer.addMethod(method);

    FullyQualifiedJavaType listOfDates = new FullyQualifiedJavaType("java.util.List<java.util.Date>"); //$NON-NLS-1$

    if (introspectedTable.hasJDBCDateColumns()) {
      topLevelClass.addImportedType(FullyQualifiedJavaType.getDateInstance());
View Full Code Here

      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "property")); //$NON-NLS-1$
      method.addBodyLine("if (value == null) {"); //$NON-NLS-1$
      method.addBodyLine("throw new RuntimeException(\"Value for \" + property + \" cannot be null\");"); //$NON-NLS-1$
      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("addCriterion(condition, new java.sql.Date(value.getTime()), property);"); //$NON-NLS-1$
      answer.addMethod(method);

      method = new Method();
      method.setVisibility(JavaVisibility.PROTECTED);
      method.setName("addCriterionForJDBCDate"); //$NON-NLS-1$
      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

      method.addBodyLine("Iterator<Date> iter = values.iterator();"); //$NON-NLS-1$
      method.addBodyLine("while (iter.hasNext()) {"); //$NON-NLS-1$
      method.addBodyLine("dateList.add(new java.sql.Date(iter.next().getTime()));"); //$NON-NLS-1$
      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("addCriterion(condition, dateList, property);"); //$NON-NLS-1$
      answer.addMethod(method);

      method = new Method();
      method.setVisibility(JavaVisibility.PROTECTED);
      method.setName("addCriterionForJDBCDate"); //$NON-NLS-1$
      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "property")); //$NON-NLS-1$
      method.addBodyLine("if (value1 == null || value2 == null) {"); //$NON-NLS-1$
      method.addBodyLine("throw new RuntimeException(\"Between values for \" + property + \" cannot be null\");"); //$NON-NLS-1$
      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);"); //$NON-NLS-1$
      answer.addMethod(method);
    }

    if (introspectedTable.hasJDBCTimeColumns()) {
      topLevelClass.addImportedType(FullyQualifiedJavaType.getDateInstance());
      topLevelClass.addImportedType(FullyQualifiedJavaType.getNewIteratorInstance());
View Full Code Here

      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "property")); //$NON-NLS-1$
      method.addBodyLine("if (value == null) {"); //$NON-NLS-1$
      method.addBodyLine("throw new RuntimeException(\"Value for \" + property + \" cannot be null\");"); //$NON-NLS-1$
      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("addCriterion(condition, new java.sql.Time(value.getTime()), property);"); //$NON-NLS-1$
      answer.addMethod(method);

      method = new Method();
      method.setVisibility(JavaVisibility.PROTECTED);
      method.setName("addCriterionForJDBCTime"); //$NON-NLS-1$
      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

      method.addBodyLine("Iterator<Date> iter = values.iterator();"); //$NON-NLS-1$
      method.addBodyLine("while (iter.hasNext()) {"); //$NON-NLS-1$
      method.addBodyLine("timeList.add(new java.sql.Time(iter.next().getTime()));"); //$NON-NLS-1$
      method.addBodyLine("}"); //$NON-NLS-1$
      method.addBodyLine("addCriterion(condition, timeList, property);"); //$NON-NLS-1$
      answer.addMethod(method);

      method = new Method();
      method.setVisibility(JavaVisibility.PROTECTED);
      method.setName("addCriterionForJDBCTime"); //$NON-NLS-1$
      method.addParameter(new Parameter(FullyQualifiedJavaType.getStringInstance(), "condition")); //$NON-NLS-1$
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.