org.mybatis.generator.internal.util.messages.Messages Java Examples
The following examples show how to use
org.mybatis.generator.internal.util.messages.Messages.
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: GenMain.java From scaffold-cloud with MIT License | 5 votes |
private static void usage() { String lines = Messages.getString("Usage.Lines"); int iLines = Integer.parseInt(lines); for (int i = 0; i < iLines; ++i) { String key = "Usage." + i; writeLine(Messages.getString(key)); } }
Example #2
Source File: SqlScriptRunner.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
private String readStatement(BufferedReader br) throws IOException { StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { if (line.startsWith("--")) { //$NON-NLS-1$ continue; } if (!StringUtility.stringHasValue(line)) { continue; } if (line.endsWith(";")) { //$NON-NLS-1$ sb.append(' '); sb.append(line.substring(0, line.length() - 1)); break; } else { sb.append(' '); sb.append(line); } } String s = sb.toString().trim(); if (s.length() > 0) { log.debug(Messages.getString("Progress.13", s)); //$NON-NLS-1$ } return s.length() > 0 ? s : null; }
Example #3
Source File: SqlScriptRunner.java From dolphin with Apache License 2.0 | 5 votes |
private String readStatement(BufferedReader br) throws IOException { StringBuffer sb = new StringBuffer(); String line; while ((line = br.readLine()) != null) { if (line.startsWith("--")) { //$NON-NLS-1$ continue; } if (!StringUtility.stringHasValue(line)) { continue; } if (line.endsWith(";")) { //$NON-NLS-1$ sb.append(line.substring(0, line.length() - 1)); break; } else { sb.append(' '); sb.append(line); } } String s = sb.toString().trim(); if (s.length() > 0) { log.debug((Messages.getString("Progress.13", s))); //$NON-NLS-1$ } return s.length() > 0 ? s : null; }
Example #4
Source File: TableConfiguration.java From mapper-generator-javafx with Apache License 2.0 | 4 votes |
public void validate(List<String> errors, int listPosition) { if (!stringHasValue(tableName)) { errors.add(Messages.getString( "ValidationError.6", Integer.toString(listPosition))); } String fqTableName = composeFullyQualifiedTableName( catalog, schema, tableName, '.'); if (generatedKey != null) { generatedKey.validate(errors, fqTableName); } // when using column indexes, either both or neither query ids // should be set if (isTrue(getProperty(PropertyRegistry.TABLE_USE_COLUMN_INDEXES)) && selectByExampleStatementEnabled && selectByPrimaryKeyStatementEnabled) { boolean queryId1Set = stringHasValue(selectByExampleQueryId); boolean queryId2Set = stringHasValue(selectByPrimaryKeyQueryId); if (queryId1Set != queryId2Set) { errors.add(Messages.getString("ValidationError.13", fqTableName)); } } if (domainObjectRenamingRule != null) { domainObjectRenamingRule.validate(errors, fqTableName); } if (columnRenamingRule != null) { columnRenamingRule.validate(errors, fqTableName); } for (ColumnOverride columnOverride : columnOverrides) { columnOverride.validate(errors, fqTableName); } for (IgnoredColumn ignoredColumn : ignoredColumns.keySet()) { ignoredColumn.validate(errors, fqTableName); } for (IgnoredColumnPattern ignoredColumnPattern : ignoredColumnPatterns) { ignoredColumnPattern.validate(errors, fqTableName); } }
Example #5
Source File: GenMain.java From scaffold-cloud with MIT License | 4 votes |
public static void main(String[] args) { if (args.length == 0) { genFile(GenMain.class.getResource("/generatorConfig.xml").getFile()); } else { Map<String, String> arguments = parseCommandLine(args); if (arguments.containsKey("-?")) { usage(); System.exit(0); } else if (!arguments.containsKey("-configfile")) { writeLine(Messages.getString("RuntimeError.0")); } else if (!arguments.containsKey("-propsFile")) { writeLine(Messages.getString("RuntimeError.0") + ":::-propsFile"); } else { List<String> warnings = new ArrayList<>(); String configfile = (String) arguments.get("-configfile"); System.out.println(configfile); String propsFile = (String) arguments.get("-propsFile"); File configurationFile = new File(configfile); System.out.println(!configurationFile.exists()); if (!configurationFile.exists()) { writeLine(Messages.getString("RuntimeError.1", configfile)); System.exit(0); } if (!new File(propsFile).exists()) { writeLine(Messages.getString("RuntimeError.1", propsFile)); System.exit(0); } propsFilePath = propsFile; String type = arguments.get("-type"); if (StringUtils.isBlank(type) || "common".equalsIgnoreCase(type)) { genFile(configfile); } else if ("dict".equalsIgnoreCase(type)) { try { CodeGenerateUtils.main(null); } catch (Exception e) { e.printStackTrace(); } } } } }
Example #6
Source File: GenMain.java From scaffold-cloud with MIT License | 4 votes |
private static Map<String, String> parseCommandLine(String[] args) { List<String> errors = new ArrayList(); Map<String, String> arguments = new HashMap(); for (int i = 0; i < args.length; ++i) { System.out.println(args[i]); } for (int i = 0; i < args.length; ++i) { if ("-configfile".equalsIgnoreCase(args[i])) { if (i + 1 < args.length) { arguments.put("-configfile", args[i + 1]); } else { errors.add(Messages.getString("RuntimeError.19", "-configfile")); } ++i; } if ("-propsFile".equalsIgnoreCase(args[i])) { if (i + 1 < args.length) { arguments.put("-propsFile", args[i + 1]); } else { errors.add(Messages.getString("RuntimeError.19", "-propsFile")); } ++i; } if ("-type".equalsIgnoreCase(args[i])) { if (i + 1 < args.length) { arguments.put("-type", args[i + 1]); } else { errors.add(Messages.getString("RuntimeError.19", "-type")); } ++i; } } if (!errors.isEmpty()) { Iterator var5 = errors.iterator(); while (var5.hasNext()) { String error = (String) var5.next(); writeLine(error); } System.exit(-1); } return arguments; }
Example #7
Source File: MavenShellCallback.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public File getDirectory(String targetProject, String targetPackage) throws ShellException { if (!"MAVEN".equals(targetProject)) { return super.getDirectory(targetProject, targetPackage); } // targetProject is the output directory from the MyBatis generator // Mojo. It will be created if necessary // // targetPackage is interpreted as a sub directory, but in package // format (with dots instead of slashes). The sub directory will be created // if it does not already exist File project = mybatisGeneratorMojo.getOutputDirectory(); if (!project.exists()) { project.mkdirs(); } if (!project.isDirectory()) { throw new ShellException(Messages.getString("Warning.9", //$NON-NLS-1$ project.getAbsolutePath())); } StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(targetPackage, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { sb.append(st.nextToken()); sb.append(File.separatorChar); } File directory = new File(project, sb.toString()); if (!directory.isDirectory()) { boolean rc = directory.mkdirs(); if (!rc) { throw new ShellException(Messages.getString("Warning.10", //$NON-NLS-1$ directory.getAbsolutePath())); } } return directory; }
Example #8
Source File: MavenShellCallback.java From dolphin with Apache License 2.0 | 4 votes |
@Override public File getDirectory(String targetProject, String targetPackage) throws ShellException { if (!"MAVEN".equals(targetProject)) { return super.getDirectory(targetProject, targetPackage); } // targetProject is the output directory from the MyBatis generator // Mojo. It will be created if necessary // // targetPackage is interpreted as a sub directory, but in package // format (with dots instead of slashes). The sub directory will be created // if it does not already exist File project = mybatisGeneratorMojo.getOutputDirectory(); if (!project.exists()) { project.mkdirs(); } if (!project.isDirectory()) { throw new ShellException(Messages.getString("Warning.9", //$NON-NLS-1$ project.getAbsolutePath())); } StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(targetPackage, "."); //$NON-NLS-1$ while (st.hasMoreTokens()) { sb.append(st.nextToken()); sb.append(File.separatorChar); } File directory = new File(project, sb.toString()); if (!directory.isDirectory()) { boolean rc = directory.mkdirs(); if (!rc) { throw new ShellException(Messages.getString("Warning.10", //$NON-NLS-1$ directory.getAbsolutePath())); } } return directory; }