001/* 002 * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.mybatisflex.processor.config; 018 019/** 020 * 配置键值。 021 * 022 * @author 王帅 023 * @since 2023-06-22 024 */ 025public enum ConfigurationKey { 026 027 /** 028 * 全局启用 APT 开关。 029 */ 030 ENABLE("processor.enable", ""), 031 032 /** 033 * 生成文件的字符集。 034 */ 035 CHARSET("processor.charset", "UTF-8"), 036 037 /** 038 * APT 代码生成路径。 039 */ 040 GEN_PATH("processor.genPath", ""), 041 042 043 /** 044 * 是否所有的类都生成在 Tables 类里。 045 */ 046 ALL_IN_TABLES_ENABLE("processor.allInTables.enable", "false"), 047 048 /** 049 * Tables 类名。 050 */ 051 ALL_IN_TABLES_CLASS_NAME("processor.allInTables.className", "Tables"), 052 053 /** 054 * 自定义 Tables 生成的包名。 055 */ 056 ALL_IN_TABLES_PACKAGE("processor.allInTables.package", null), 057 058 059 /** 060 * 开启 Mapper 自动生成。 061 */ 062 MAPPER_GENERATE_ENABLE("processor.mapper.generateEnable", "false"), 063 064 /** 065 * 开启 @Mapper 注解。 066 */ 067 MAPPER_ANNOTATION("processor.mapper.annotation", "false"), 068 069 /** 070 * 自定义 Mapper 的父类。 071 */ 072 MAPPER_BASE_CLASS("processor.mapper.baseClass", "com.mybatisflex.core.BaseMapper"), 073 074 /** 075 * 自定义 Mapper 生成的包名。 076 */ 077 MAPPER_PACKAGE("processor.mapper.package", null), 078 079 080 /** 081 * 生成的 Class 的后缀。 082 */ 083 TABLE_DEF_CLASS_SUFFIX("processor.tableDef.classSuffix", "TableDef"), 084 085 /** 086 * 生成的表对应的变量后缀。 087 */ 088 TABLE_DEF_INSTANCE_SUFFIX("processor.tableDef.instanceSuffix", ""), 089 090 /** 091 * 生成辅助类的字段风格。 092 */ 093 TABLE_DEF_PROPERTIES_NAME_STYLE("processor.tableDef.propertiesNameStyle", "upperCase"), 094 095 /** 096 * 过滤 Entity 后缀。 097 */ 098 TABLE_DEF_IGNORE_ENTITY_SUFFIXES("processor.tableDef.ignoreEntitySuffixes", ""); 099 100 101 private final String configKey; 102 private final String defaultValue; 103 104 ConfigurationKey(String configKey, String defaultValue) { 105 this.configKey = configKey; 106 this.defaultValue = defaultValue; 107 } 108 109 /** 110 * 获取配置键。 111 * 112 * @return 键 113 */ 114 public String getConfigKey() { 115 return configKey; 116 } 117 118 /** 119 * 获取配置默认值。 120 * 121 * @return 默认值 122 */ 123 public String getDefaultValue() { 124 return defaultValue; 125 } 126 127}