View Javadoc
1   /*
2    *    Copyright 2006-2023 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.mybatis.generator.internal.rules;
17  
18  import org.mybatis.generator.api.IntrospectedTable;
19  
20  /**
21   * This class encapsulates all the code generation rules for a table using the
22   * flat model.
23   *
24   * @author Jeff Butler
25   */
26  public class FlatModelRules extends BaseRules {
27  
28      /**
29       * Instantiates a new flat model rules.
30       *
31       * @param introspectedTable
32       *            the introspected table
33       */
34      public FlatModelRules(IntrospectedTable introspectedTable) {
35          super(introspectedTable);
36      }
37  
38      /**
39       * We never generate a primary key in the flat model.
40       *
41       * @return true if the primary key should be generated
42       */
43      @Override
44      public boolean generatePrimaryKeyClass() {
45          return false;
46      }
47  
48      /**
49       * We always generate a base record in the flat model.
50       *
51       * @return true if the class should be generated
52       */
53      @Override
54      public boolean generateBaseRecordClass() {
55          return true;
56      }
57  
58      /**
59       * We never generate a record with BLOBs class in the flat model.
60       *
61       * @return true if the record with BLOBs class should be generated
62       */
63      @Override
64      public boolean generateRecordWithBLOBsClass() {
65          return false;
66      }
67  }