/** * Gets the path from the given class. For instance /java/lang/Object.class if the given class * is from {@code Object} * * @param clazz * The class. * @return the path from the given class. */ public static String getPath(final Class<?> clazz) { final String path = "/" + clazz.getName().replaceAll("\\.", "/") + FileExtension.CLASS.getExtension(); return path; }
/** * Gets the path from the given class. For instance /java/lang/Object.class if the given class * is from {@code Object} * * @param clazz * The class. * @return the path from the given class. */ public static String getPath(final Class<?> clazz) { final String path = "/" + clazz.getName().replaceAll("\\.", "/") + FileExtension.CLASS.getExtension(); return path; }
/** * Gets the classname and concats the suffix ".class" from the class. * * @param clazz * The class. * @return The classname and concats the suffix ".class". */ public static String getClassnameWithSuffix(final Class<?> clazz) { String className = clazz.getName(); className = className.substring(className.lastIndexOf('.') + 1) + FileExtension.CLASS.getExtension(); return className; }
/** * Gets the classname and concats the suffix ".class" from the class. * * @param clazz * The class. * @return The classname and concats the suffix ".class". */ public static String getClassnameWithSuffix(final Class<?> clazz) { String className = clazz.getName(); className = className.substring(className.lastIndexOf('.') + 1) + FileExtension.CLASS.getExtension(); return className; }
/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { final StringBuilder buffer = new StringBuilder(); buffer.append("[ClassFileFilter:"); buffer.append(FileExtension.CLASS.getExtension()); buffer.append("]"); return buffer.toString(); }
/** * To string. * * @return the string {@inheritDoc} * @see java.lang.Object#toString() */ @Override public String toString() { final StringBuilder buffer = new StringBuilder(); buffer.append("[TxtFileFilter:"); buffer.append(FileExtension.TXT.getExtension()); buffer.append("]"); return buffer.toString(); }
/** * Instantiates a new properties directory walker. */ public PropertiesDirectoryWalker() { super(new MultiplyExtensionsFileFilter(true, FileExtension.PROPERTIES.getExtension()), -1); files = new ArrayList<>(); }
/** * {@inheritDoc} * * @see java.io.FileFilter#accept(java.io.File) */ @Override public boolean accept(final File pathname) { // To allow recursive search we use file.isDirectory()-method. if (pathname.isDirectory()) { return true; } else { final String fileName = pathname.getName().toLowerCase(); if (fileName.endsWith(FileExtension.CLASS.getExtension())) { return true; } } return false; }
/** * Accept. * * @param pathname * the pathname * @return true, if successful {@inheritDoc} * @see java.io.FileFilter#accept(java.io.File) */ @Override public boolean accept(final File pathname) { // To allow recursive search we use file.isDirectory()-method. if (pathname.isDirectory()) { return true; } else { final String fileName = pathname.getName().toLowerCase(); if (fileName.endsWith(FileExtension.TXT.getExtension())) { return true; } } return false; }
/** * Normalizes the given simple class name. * * @param className * the class name to normalize. * @return The normalized class name. */ public static String normalizeSimpleClassName(final String className) { String result = className; if (className.endsWith(FileExtension.CLASS.getExtension())) { result = className.replaceLast(FileExtension.CLASS.getExtension(), ""); } final int lastIndexOf$ = result.lastIndexOf("$"); if (lastIndexOf$ != -1) { final String prefix = result.substring(0, lastIndexOf$); final String compilerClassName = result.substring(lastIndexOf$ + 1, result.length()); if (StringUtils.isNumeric(compilerClassName)) { return prefix; } } return result; }
/** * Normalizes the given simple class name. * * @param className * the class name to normalize. * @return The normalized class name. */ public static String normalizeSimpleClassName(final String className) { String result = className; if (className.endsWith(FileExtension.CLASS.getExtension())) { result = className.replaceLast(FileExtension.CLASS.getExtension(), ""); } final int lastIndexOf$ = result.lastIndexOf("$"); if (lastIndexOf$ != -1) { final String prefix = result.substring(0, lastIndexOf$); final String compilerClassName = result.substring(lastIndexOf$ + 1, result.length()); if (StringUtils.isNumeric(compilerClassName)) { return prefix; } } return result; }
/** * Creates a backup file in the same directory with the same name of the given file and with the * extension of '*.bak'. * * @param file * the file to backup. * @param sourceEncoding * the source encoding of the file to backup. * @param destinationEncoding * the destination encoding of the backup file. This can be null. * @return the created backup file. * @throws IOException * Signals that an I/O exception has occurred. */ public static File newBackupOf(final File file, final Charset sourceEncoding, final Charset destinationEncoding) throws IOException { final File backup = new File(file.getAbsolutePath() + FileExtension.BACKUP.getExtension()); CopyFileExtensions.copyFile(file, backup, sourceEncoding, destinationEncoding, true); return backup; }
propertiesName.append(FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename; propertiesName.append(FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename; FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename;
propertiesName.append(FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename; propertiesName.append(FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename; .append(FileExtension.PROPERTIES.getExtension()); filename = propertiesName.toString().trim(); pathAndFilename = packagePath + filename;
+ FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplRepositoryClass(), getEntitiesProjectPath(pomGenerationData), repositoryClassPath, withProjectPath); + FileSuffix.TEST + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplRepositoryTestClass(), getInitProjectPath(pomGenerationData), repositoryTestClassPath, withProjectPath); + model.getServiceClassName() + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplServiceInterface(), getBusinessProjectPath(pomGenerationData), serviceInterfacePath, withProjectPath); + FileSuffix.BUSINESS_SERVICE + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplServiceClass(), getBusinessProjectPath(pomGenerationData), serviceClassPath, withProjectPath); + FileSuffix.BUSINESS_SERVICE + FileSuffix.TEST + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplServiceTestClass(), getInitProjectPath(pomGenerationData), serviceTestClassPath, withProjectPath); + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplDomainClass(), getDomainProjectPath(pomGenerationData), domainClassPath, withProjectPath); + FileSuffix.MAPPER + FileExtension.JAVA.getExtension(); mergeProjectFile(context, getVelocityTemplates().getTmplDomainMapperClass(), getDomainProjectPath(pomGenerationData), domainMapperClassPath, withProjectPath); + model.getDomainServiceClassName() + FileExtension.JAVA.getExtension();
+ DB_INIT_PATH + INITIALIZE_DATABASE_CLASSNAME + FileExtension.JAVA.getExtension(); VelocityExtensions.mergeToContext(context, getVelocityTemplates().getTmplInitInitDbClass(), initProjectPath + "/" + initializeDatabaseClassPath); + FileExtension.JAVA.getExtension(); VelocityExtensions.mergeToContext(context, getVelocityTemplates().getTmplInitDbInitClass(), initProjectPath + "/" + databaseInitializationClassPath); + FileExtension.JAVA.getExtension(); VelocityExtensions.mergeToContext(context, getVelocityTemplates().getTmplJettyRunnerClass(), restWebProjectPath + "/" + applicationJettyRunnerClassPath);