org.mybatis.generator.config.PropertyRegistry Java Examples
The following examples show how to use
org.mybatis.generator.config.PropertyRegistry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IntrospectedTableMyBatis3Impl.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
@Override public List<GeneratedJavaFile> getGeneratedJavaFiles() { List<GeneratedJavaFile> answer = new ArrayList<>(); for (AbstractJavaGenerator javaGenerator : javaGenerators) { List<CompilationUnit> compilationUnits = javaGenerator.getCompilationUnits(); for (CompilationUnit compilationUnit : compilationUnits) { GeneratedJavaFile gjf = new GeneratedJavaFile(compilationUnit, javaGenerator.getProject(), context.getProperty(PropertyRegistry.CONTEXT_JAVA_FILE_ENCODING), context.getJavaFormatter()); answer.add(gjf); } } return answer; }
Example #2
Source File: AbstractDAOElementGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
public JavaVisibility getExampleMethodVisibility() { if (exampleMethodVisibility == null) { String type = context .getJavaClientGeneratorConfiguration() .getProperty(PropertyRegistry.DAO_EXAMPLE_METHOD_VISIBILITY); if (stringHasValue(type)) { if ("public".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PUBLIC; } else if ("private".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PRIVATE; } else if ("protected".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PROTECTED; } else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.DEFAULT; } else { exampleMethodVisibility = JavaVisibility.PUBLIC; warnings.add(getString("Warning.16", type)); //$NON-NLS-1$ } } else { exampleMethodVisibility = JavaVisibility.PUBLIC; } } return exampleMethodVisibility; }
Example #3
Source File: AbstractDAOElementGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
public DAOMethodNameCalculator getDAOMethodNameCalculator() { if (dAOMethodNameCalculator == null) { String type = context.getJavaClientGeneratorConfiguration() .getProperty(PropertyRegistry.DAO_METHOD_NAME_CALCULATOR); if (stringHasValue(type)) { if ("extended".equalsIgnoreCase(type)) { //$NON-NLS-1$ type = ExtendedDAOMethodNameCalculator.class.getName(); } else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$ type = DefaultDAOMethodNameCalculator.class.getName(); } } else { type = DefaultDAOMethodNameCalculator.class.getName(); } try { dAOMethodNameCalculator = (DAOMethodNameCalculator) ObjectFactory .createInternalObject(type); } catch (Exception e) { dAOMethodNameCalculator = new DefaultDAOMethodNameCalculator(); warnings.add(getString( "Warning.17", type, e.getMessage())); //$NON-NLS-1$ } } return dAOMethodNameCalculator; }
Example #4
Source File: AbstractDAOElementGenerator.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
public JavaVisibility getExampleMethodVisibility() { if (exampleMethodVisibility == null) { String type = context .getJavaClientGeneratorConfiguration() .getProperty(PropertyRegistry.DAO_EXAMPLE_METHOD_VISIBILITY); if (stringHasValue(type)) { if ("public".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PUBLIC; } else if ("private".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PRIVATE; } else if ("protected".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.PROTECTED; } else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$ exampleMethodVisibility = JavaVisibility.DEFAULT; } else { exampleMethodVisibility = JavaVisibility.PUBLIC; warnings.add(getString("Warning.16", type)); //$NON-NLS-1$ } } else { exampleMethodVisibility = JavaVisibility.PUBLIC; } } return exampleMethodVisibility; }
Example #5
Source File: AbstractDAOElementGenerator.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
public DAOMethodNameCalculator getDAOMethodNameCalculator() { if (dAOMethodNameCalculator == null) { String type = context.getJavaClientGeneratorConfiguration() .getProperty(PropertyRegistry.DAO_METHOD_NAME_CALCULATOR); if (stringHasValue(type)) { if ("extended".equalsIgnoreCase(type)) { //$NON-NLS-1$ type = ExtendedDAOMethodNameCalculator.class.getName(); } else if ("default".equalsIgnoreCase(type)) { //$NON-NLS-1$ type = DefaultDAOMethodNameCalculator.class.getName(); } } else { type = DefaultDAOMethodNameCalculator.class.getName(); } try { dAOMethodNameCalculator = (DAOMethodNameCalculator) ObjectFactory .createInternalObject(type); } catch (Exception e) { dAOMethodNameCalculator = new DefaultDAOMethodNameCalculator(); warnings.add(getString( "Warning.17", type, e.getMessage())); //$NON-NLS-1$ } } return dAOMethodNameCalculator; }
Example #6
Source File: AnnotatedClientGenerator.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
@Override public List<CompilationUnit> getExtraCompilationUnits() { boolean useLegacyBuilder = false; String prop = context.getJavaClientGeneratorConfiguration() .getProperty(PropertyRegistry.CLIENT_USE_LEGACY_BUILDER); if (StringUtility.stringHasValue(prop)) { useLegacyBuilder = Boolean.valueOf(prop); } SqlProviderGenerator sqlProviderGenerator = new SqlProviderGenerator(getProject(), useLegacyBuilder); sqlProviderGenerator.setContext(context); sqlProviderGenerator.setIntrospectedTable(introspectedTable); sqlProviderGenerator.setProgressCallback(progressCallback); sqlProviderGenerator.setWarnings(warnings); return sqlProviderGenerator.getCompilationUnits(); }
Example #7
Source File: IntrospectedTable.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * Checks if is constructor based. * * @return true, if is constructor based */ public boolean isConstructorBased() { if (isImmutable()) { return true; } Properties properties; if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_CONSTRUCTOR_BASED)) { properties = tableConfiguration.getProperties(); } else { properties = context.getJavaModelGeneratorConfiguration().getProperties(); } return isTrue(properties.getProperty(PropertyRegistry.ANY_CONSTRUCTOR_BASED)); }
Example #8
Source File: DynamicSqlMapperGenerator.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
private Interface createBasicInterface() { FullyQualifiedJavaType type = new FullyQualifiedJavaType( introspectedTable.getMyBatis3JavaMapperType()); Interface interfaze = new Interface(type); interfaze.setVisibility(JavaVisibility.PUBLIC); context.getCommentGenerator().addJavaFileComment(interfaze); interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper")); interfaze.addAnnotation("@Mapper"); String rootInterface = introspectedTable.getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE); if (!stringHasValue(rootInterface)) { rootInterface = context.getJavaClientGeneratorConfiguration().getProperty(PropertyRegistry.ANY_ROOT_INTERFACE); } if (stringHasValue(rootInterface)) { FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(rootInterface); interfaze.addSuperInterface(fqjt); interfaze.addImportedType(fqjt); } return interfaze; }
Example #9
Source File: DefaultCommentGenerator.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
@Override public void addConfigurationProperties(Properties properties) { this.properties.putAll(properties); suppressDate = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE)); suppressAllComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS)); addRemarkComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS)); String dateFormatString = properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_DATE_FORMAT); if (StringUtility.stringHasValue(dateFormatString)) { dateFormat = new SimpleDateFormat(dateFormatString); } }
Example #10
Source File: JavaBeansUtil.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Checks if is trim strings enabled. * * @param context * the context * @return true, if is trim strings enabled */ private static boolean isTrimStringsEnabled(Context context) { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); boolean rc = isTrue(properties .getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS)); return rc; }
Example #11
Source File: ObjectFactory.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Creates a new Object object. * * @param context * the context * @return the xml formatter */ public static XmlFormatter createXmlFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_XML_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultXmlFormatter.class.getName(); } XmlFormatter answer = (XmlFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example #12
Source File: ObjectFactory.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Creates a new Object object. * * @param context * the context * @return the java formatter */ public static JavaFormatter createJavaFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultJavaFormatter.class.getName(); } JavaFormatter answer = (JavaFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example #13
Source File: DefaultCommentGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
public void addConfigurationProperties(Properties properties) { this.properties.putAll(properties); suppressDate = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE)); suppressAllComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS)); addRemarkComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_ADD_REMARK_COMMENTS)); }
Example #14
Source File: AbstractJavaGenerator.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
public String getRootClass() { String rootClass = introspectedTable .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_CLASS); if (rootClass == null) { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); rootClass = properties.getProperty(PropertyRegistry.ANY_ROOT_CLASS); } return rootClass; }
Example #15
Source File: BaseRules.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Instantiates a new base rules. * * @param introspectedTable * the introspected table */ public BaseRules(IntrospectedTable introspectedTable) { super(); this.introspectedTable = introspectedTable; this.tableConfiguration = introspectedTable.getTableConfiguration(); String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY); isModelOnly = StringUtility.isTrue(modelOnly); }
Example #16
Source File: JavaBeansUtil.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private static boolean isTrimStringsEnabled(IntrospectedTable table) { TableConfiguration tableConfiguration = table.getTableConfiguration(); String trimSpaces = tableConfiguration.getProperties().getProperty( PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS); if (trimSpaces != null) { return isTrue(trimSpaces); } return isTrimStringsEnabled(table.getContext()); }
Example #17
Source File: JavaBeansUtil.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private static boolean isTrimStringsEnabled(IntrospectedColumn column) { String trimSpaces = column.getProperties().getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS); if (trimSpaces != null) { return isTrue(trimSpaces); } return isTrimStringsEnabled(column.getIntrospectedTable()); }
Example #18
Source File: IntrospectedTable.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
/** * Checks if is immutable. * * @return true, if is immutable */ public boolean isImmutable() { Properties properties; if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_IMMUTABLE)) { properties = tableConfiguration.getProperties(); } else { properties = context.getJavaModelGeneratorConfiguration().getProperties(); } return isTrue(properties.getProperty(PropertyRegistry.ANY_IMMUTABLE)); }
Example #19
Source File: JavaTypeResolverCalendarImpl.java From maven-archetype with GNU Lesser General Public License v2.1 | 5 votes |
public void addConfigurationProperties(Properties properties) { this.properties.putAll(properties); forceBigDecimals = StringUtility .isTrue(properties .getProperty(PropertyRegistry.TYPE_RESOLVER_FORCE_BIG_DECIMALS)); this.jdbcDateToJavaType = StringUtility.escapeStringForJava(properties.getProperty("DATE")); this.jdbcTimestampToJavaType = StringUtility.escapeStringForJava(properties.getProperty("TIME")); this.jdbcTimeToJavaType = StringUtility.escapeStringForJava(properties.getProperty("TIMESTAMP")); }
Example #20
Source File: AbstractJavaGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
public String getRootClass() { String rootClass = introspectedTable .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_CLASS); if (rootClass == null) { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); rootClass = properties.getProperty(PropertyRegistry.ANY_ROOT_CLASS); } return rootClass; }
Example #21
Source File: AnnotatedClientGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
@Override public List<CompilationUnit> getExtraCompilationUnits() { boolean useLegacyBuilder = false; String prop = context.getJavaClientGeneratorConfiguration().getProperty(PropertyRegistry.CLIENT_USE_LEGACY_BUILDER); if (StringUtility.stringHasValue(prop)) { useLegacyBuilder = Boolean.valueOf(prop); } SqlProviderGenerator sqlProviderGenerator = new SqlProviderGenerator(useLegacyBuilder); sqlProviderGenerator.setContext(context); sqlProviderGenerator.setIntrospectedTable(introspectedTable); sqlProviderGenerator.setProgressCallback(progressCallback); sqlProviderGenerator.setWarnings(warnings); return sqlProviderGenerator.getCompilationUnits(); }
Example #22
Source File: IntrospectedTable.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public boolean isImmutable() { Properties properties; if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_IMMUTABLE)) { properties = tableConfiguration.getProperties(); } else { properties = context.getJavaModelGeneratorConfiguration().getProperties(); } return isTrue(properties.getProperty(PropertyRegistry.ANY_IMMUTABLE)); }
Example #23
Source File: IntrospectedTable.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public boolean isConstructorBased() { if (isImmutable()) { return true; } Properties properties; if (tableConfiguration.getProperties().containsKey(PropertyRegistry.ANY_CONSTRUCTOR_BASED)) { properties = tableConfiguration.getProperties(); } else { properties = context.getJavaModelGeneratorConfiguration().getProperties(); } return isTrue(properties.getProperty(PropertyRegistry.ANY_CONSTRUCTOR_BASED)); }
Example #24
Source File: BaseRules.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
/** * */ public BaseRules(IntrospectedTable introspectedTable) { super(); this.introspectedTable = introspectedTable; this.tableConfiguration = introspectedTable.getTableConfiguration(); String modelOnly = tableConfiguration.getProperty(PropertyRegistry.TABLE_MODEL_ONLY); isModelOnly = StringUtility.isTrue(modelOnly); }
Example #25
Source File: DefaultCommentGenerator.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public void addConfigurationProperties(Properties properties) { this.properties.putAll(properties); suppressDate = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE)); suppressAllComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS)); }
Example #26
Source File: ObjectFactory.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static JavaFormatter createJavaFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultJavaFormatter.class.getName(); } JavaFormatter answer = (JavaFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example #27
Source File: ObjectFactory.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public static XmlFormatter createXmlFormatter(Context context) { String type = context.getProperty(PropertyRegistry.CONTEXT_XML_FORMATTER); if (!StringUtility.stringHasValue(type)) { type = DefaultXmlFormatter.class.getName(); } XmlFormatter answer = (XmlFormatter) createInternalObject(type); answer.setContext(context); return answer; }
Example #28
Source File: AbstractJavaGenerator.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public boolean isTrimStringsEnabled() { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); boolean rc = isTrue(properties .getProperty(PropertyRegistry.MODEL_GENERATOR_TRIM_STRINGS)); return rc; }
Example #29
Source File: AbstractJavaGenerator.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public String getRootClass() { String rootClass = introspectedTable .getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_CLASS); if (rootClass == null) { Properties properties = context .getJavaModelGeneratorConfiguration().getProperties(); rootClass = properties.getProperty(PropertyRegistry.ANY_ROOT_CLASS); } return rootClass; }
Example #30
Source File: CommentGenerator.java From dolphin with Apache License 2.0 | 5 votes |
@Override public void addConfigurationProperties(Properties properties) { super.addConfigurationProperties(properties); // stolen from the parent suppressDate = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE)); suppressAllComments = isTrue(properties .getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS)); if(suppressAllComments) return; // 获取国际化资源的路径 i18nPath = properties.getProperty(XMBG_CG_I18N_PATH_KEY, XMBG_CG_I18N_DEFAULT_PATH); LOG.info("use the i18n resources under {}",i18nPath); // 获取项目开始时间,用在版权声明中 String startYearStr = properties.getProperty(XMBG_CG_PROJECT_START_YEAR); if(StringUtils.isNotEmpty(startYearStr)){ startYear = startYearStr; }else{ startYear = XMBG_CG_PROJECT_START_DEFAULT_YEAR; } // 初始化资源 String localeStr = properties.getProperty(XMBG_CG_I18N_LOCALE_KEY); Locale locale = Locale.getDefault(); if(localeStr != null && StringUtils.isNoneEmpty(localeStr)) { String[] localeAras = localeStr.trim().split("_"); locale = new Locale(localeAras[0], localeAras[1]); } LOG.info("use the locale {}",locale); try { initResources(locale); } catch (MalformedURLException e) { e.printStackTrace(); } }