congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
SkeletonUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
SkeletonUtil
in
cn.springcloud.codegen.engine.util

Best Java code snippets using cn.springcloud.codegen.engine.util.SkeletonUtil (Showing top 17 results out of 315)

origin: SpringCloud/spring-cloud-codegen

public static String getBasePackagePath(SkeletonProperties skeletonProperties) {
  return getBasePackagePath(null, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

public static String getCanonicalPath(String generatePath, String fileName, SkeletonProperties skeletonProperties) {
  return formatGeneratePath(generatePath) + getCanonicalFileName(fileName, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

public static String getOutputPath(String generatePath, String projectType, SkeletonProperties skeletonProperties) {
  return formatGeneratePath(generatePath) + (StringUtils.isNotEmpty(projectType) ? getBaseDirectoryName(projectType, skeletonProperties) + "/" : "");
}
origin: SpringCloud/spring-cloud-codegen

private void initialize() {
  String generatePath = skeletonContext.getGeneratePath();
  String projectType = skeletonContext.getProjectType();
  defaultBasePackage = SkeletonUtil.getBasePackagePath(projectType, skeletonProperties);
  defaultOutputPath = SkeletonUtil.getOutputPath(generatePath, projectType, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

public byte[] download(String generatePath, String fileName, SkeletonProperties skeletonProperties) {
  if (StringUtils.isEmpty(generatePath)) {
    generatePath = SkeletonUtil.getTempGeneratePath();
  }
  if (StringUtils.isEmpty(fileName)) {
    throw new SkeletonException("File name is null or empty");
  }
  try {
    String canonicalPath = SkeletonUtil.getCanonicalPath(generatePath, fileName, skeletonProperties);
    generate(canonicalPath, skeletonProperties);
    String zipFilePath = ZipUtil.zip(canonicalPath, null);
    File zipFile = new File(zipFilePath);
    LOG.info("Download skeleton file for " + zipFile.getName() + " is executed");
    return FileUtil.getBytes(zipFile);
  } catch (Exception e) {
    throw new SkeletonException(e.getMessage(), e);
  } finally {
    File directory = new File(generatePath);
    FileUtil.forceDeleteDirectory(directory, 5);
  }
}
origin: SpringCloud/spring-cloud-codegen

  public static String getTempGeneratePath() {
    String tempGeneratePath = formatGeneratePath(System.getProperty("java.io.tmpdir")) + SkeletonConstant.SKELETON;

    return tempGeneratePath;
  }
}
origin: SpringCloud/spring-cloud-codegen

public static String getBaseDirectoryName(SkeletonProperties skeletonProperties) {
  return getBaseDirectoryName(null, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

public static String getOutputPath(String generatePath, SkeletonProperties skeletonProperties) {
  return getOutputPath(generatePath, null, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

public String getCanonicalFileName(String fileName, SkeletonProperties skeletonProperties) {
  if (StringUtils.isEmpty(fileName)) {
    throw new SkeletonException("File name is null or empty");
  }
  try {
    String canonicalFileName = SkeletonUtil.getCanonicalFileName(fileName, skeletonProperties);
    return URLEncoder.encode(canonicalFileName + ".zip", SkeletonConstant.ENCODING_UTF_8);
  } catch (UnsupportedEncodingException e) {
    throw new SkeletonException(e.getMessage(), e);
  }
}
origin: SpringCloud/spring-cloud-codegen

public static String getBasePackagePath(String projectType, SkeletonProperties skeletonProperties) {
  String projectName = skeletonProperties.getString(SkeletonConstant.PROJECT_NAME);
  return skeletonProperties.getString(SkeletonConstant.BASE_PACKAGE) + "." + formatProjectName(projectName) + (StringUtils.isNotEmpty(projectType) ? "." + projectType : "");
}
origin: SpringCloud/spring-cloud-codegen

  private String generateTemplatePath() {
    if (generatorClass != null) {
      return SkeletonConstant.FILE_SEPARATOR + (StringUtils.isNotEmpty(prefixTemplatePath) ? prefixTemplatePath + SkeletonConstant.FILE_SEPARATOR : "") + SkeletonUtil.formatGeneratePath(generatorClass, reducedTemplatePath);
    }

    return SkeletonConstant.FILE_SEPARATOR + SkeletonUtil.formatGeneratePath(baseTemplatePath) + (StringUtils.isNotEmpty(projectType) ? projectType : "") + SkeletonConstant.FILE_SEPARATOR + fileType;
  }
}
origin: SpringCloud/spring-cloud-codegen

public static String getCanonicalFileName(String fileName, SkeletonProperties skeletonProperties) {
  return fileName + "-" + getBaseDirectoryName(skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

private void initialize() {
  /*SkeletonFileType fileType = skeletonContext.getFileType();
  if (fileType != null && fileType == SkeletonFileType.JAVA) {
    throw new SkeletonException("Invalid file type for " + fileType);
  }*/
  String generatePath = skeletonContext.getGeneratePath();
  String projectType = skeletonContext.getProjectType();
  defaultOutputPath = SkeletonUtil.getOutputPath(generatePath, projectType, skeletonProperties);
}
origin: SpringCloud/spring-cloud-codegen

  @Override
  protected Object getDataModel() {

    Map<String, Object> dataModel = new HashMap<String, Object>();
    dataModel.put("parentPomArtifactId", skeletonProperties.getString("pomArtifactId"));
    dataModel.put("pomGroupId", skeletonProperties.getString("pomGroupId"));
    dataModel.put("pomArtifactId", skeletonProperties.getString("pomArtifactId") + "-" + getSkeletonContext().getProjectType());
    dataModel.put("pomName", skeletonProperties.getString("pomName") + " " + StringUtil.firstLetterToUpper(getSkeletonContext().getProjectType()));
    dataModel.put("pomVersion", skeletonProperties.getString("pomVersion"));
    dataModel.put("javaImageVersion", skeletonProperties.getString("javaImageVersion"));
    dataModel.put("mainClass", SkeletonUtil.getBasePackagePath(getSkeletonContext().getProjectType(), skeletonProperties) + "." + StringUtil.firstLetterToUpper(getSkeletonContext().getProjectType()) + "Application");
    dataModel.put("clientHystrixEnabled", skeletonProperties.getString("clientHystrixEnabled"));

    return dataModel;
  }
}
origin: SpringCloud/spring-cloud-codegen

@Override
protected String getPath() throws SkeletonException {
  String fileName = null;
  String outputPath = null;
  Object dataModel = null;
  try {
    fileName = getFileName();
    outputPath = getOutputPath();
    dataModel = getDataModel();
  } catch (Exception e) {
    throw new SkeletonException(e.getMessage(), e);
  }
  String fullPath = SkeletonUtil.formatGeneratePath(outputPath) + fileName;
  LOG.info("--------------- File Generator Information ---------------");
  LOG.info("Template Path : {}", getSkeletonContext().getConfig().getTemplatePath() + SkeletonConstant.FILE_SEPARATOR + getTemplateName());
  LOG.info("Output Path : {}", fullPath);
  LOG.info("Data Model : {}", dataModel);
  LOG.info("----------------------------------------------------------");
  return fullPath;
}
origin: SpringCloud/spring-cloud-codegen

  @Override
  protected Object getDataModel() {
    Map<String, Object> dataModel = new HashMap<String, Object>();

    dataModel.put("springBootVersion", skeletonProperties.getString("springboot-version"));
//        dataModel.put("springCloudVersion", skeletonProperties.getString("springCloudVersion"));
    dataModel.put("javaVersion", skeletonProperties.getString("javaVersion"));

    dataModel.put("pomGroupId", skeletonProperties.getString("pomGroupId"));
    dataModel.put("pomArtifactId", skeletonProperties.getString("pomArtifactId") + "-" + getSkeletonContext().getProjectType());
    dataModel.put("pomName", skeletonProperties.getString("pomArtifactId") + " " + StringUtil.firstLetterToUpper(getSkeletonContext().getProjectType()));
//        dataModel.put("pomVersion", skeletonProperties.getString("pomVersion"));

//        dataModel.put("javaImageVersion", skeletonProperties.getString("javaImageVersion"));
    dataModel.put("mainClass", SkeletonUtil.getBasePackagePath(getSkeletonContext().getProjectType(), skeletonProperties) + "." + StringUtil.firstLetterToUpper(getSkeletonContext().getProjectType()) + "Application");
    return dataModel;
  }
}
origin: SpringCloud/spring-cloud-codegen

@Override
protected String getPath() throws SkeletonException {
  String className = null;
  String packagePath = null;
  String outputPath = null;
  boolean isMainCode = true;
  Object dataModel = null;
  try {
    className = getClassName();
    packagePath = getPackage();
    outputPath = getOutputPath();
    isMainCode = isMainCode();
    dataModel = getDataModel();
  } catch (Exception e) {
    throw new SkeletonException(e.getMessage(), e);
  }
  String fullPath = SkeletonUtil.formatGeneratePath(outputPath) + (isMainCode ? SkeletonConstant.MAIN_JAVA_CODE_PATH : SkeletonConstant.TEST_JAVA_CODE_PATH) + packagePath.replace(".", SkeletonConstant.FILE_SEPARATOR) + SkeletonConstant.FILE_SEPARATOR + className + "." + SkeletonConstant.JAVA;
  LOG.info("--------------- Java Generator Information ---------------");
  LOG.info("Template Path : {}", getSkeletonContext().getConfig().getTemplatePath() + SkeletonConstant.FILE_SEPARATOR + getTemplateName());
  LOG.info("Output Path : {}", fullPath);
  LOG.info("Package : {}", packagePath);
  LOG.info("Data Model : {}", dataModel);
  LOG.info("----------------------------------------------------------");
  return fullPath;
}
cn.springcloud.codegen.engine.utilSkeletonUtil

Most used methods

  • getBasePackagePath
  • formatGeneratePath
  • formatProjectName
  • getBaseDirectoryName
  • getCanonicalFileName
  • getCanonicalPath
  • getOutputPath
  • getTempGeneratePath

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now