public static void printAllTableNames(List<Table> tables) throws Exception {
   GLogger.println("\n----All TableNames BEGIN----");
   for (int i = 0; i < tables.size(); i++) {
     String sqlName = ((Table) tables.get(i)).getSqlName();
     //				GLogger.println("g.generateTable(\"" + sqlName + "\");");
     GLogger.println("for maven.please use [mvn rapid:gen -Dtable=" + sqlName + "]");
   }
   GLogger.println("----All TableNames END----");
 }
 public static void reload() {
   try {
     GLogger.println(
         "Start Load GeneratorPropeties from classpath:" + Arrays.toString(PROPERTIES_FILE_NAMES));
     Properties p = new Properties();
     String[] loadedFiles =
         PropertiesHelper.loadAllPropertiesFromClassLoader(p, PROPERTIES_FILE_NAMES);
     GLogger.println("GeneratorPropeties Load Success,files:" + Arrays.toString(loadedFiles));
     setProperties(p);
   } catch (IOException e) {
     throw new RuntimeException("Load " + PROPERTIES_FILE_NAMES + " error", e);
   }
 }
  public static void setProperties(Properties inputProps) {
    props = new PropertiesHelper(resolveProperties(inputProps));
    for (Iterator it = props.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry entry = (Map.Entry) it.next();
      GLogger.println("[Property] " + entry.getKey() + "=" + entry.getValue());
    }
    GLogger.println("");

    GLogger.println(
        "[Auto Replace] [.] => [/] on generator.properties, key=source_key+'_dir', For example: pkg=com.company ==> pkg_dir=com/company  \n");
    Properties dirProperties = autoReplacePropertiesValue2DirValue(props.getProperties());
    props.getProperties().putAll(dirProperties);
  }
示例#4
0
 public static void debug(String string, Map templateModel) {
   if (logLevel <= DEBUG) {
     GLogger.println(string);
     if (templateModel == null) return;
     for (Object key : templateModel.keySet()) {
       if (System.getProperties().containsKey(key)
           || GeneratorProperties.getProperties().containsKey(key)) {
         continue;
       }
       if (key.toString().endsWith("_dir")) {
         continue;
       }
       GLogger.println(key + " = " + templateModel.get(key));
     }
   }
 }
 public static void setProperty(String key, String value) {
   value = resolveProperty(value, getProperties());
   key = resolveProperty(key, getProperties());
   GLogger.println("[setProperty()] " + key + "=" + value);
   getHelper().setProperty(key, value);
   String dir_value = value.toString().replace('.', '/');
   getHelper().getProperties().put(key + "_dir", dir_value);
 }
 private static void printBeginProcess(String displayText, boolean isDatele) {
   GLogger.println("***************************************************************");
   GLogger.println("* BEGIN " + (isDatele ? " delete by " : " generate by ") + displayText);
   GLogger.println("***************************************************************");
 }