import * as path from 'path' ; import { JavaBuildTool } from '../../../constants' ; import { localize } from "../../../localize" ; import { IProjectWizardContext } from "../IProjectWizardContext" ; export interface IJavaProjectWizardContext extends IProjectWizardContext { javaVersion ? : string ; javaGroupId ? : string ; javaArtifactId ? : string ; javaProjectVersion ? : string ; javaPackageName ? : string ; javaAppName ? : string ; buildTool ? : JavaBuildTool ; } export function getJavaClassName ( name ) { name = name . replace ( '-' , '_' ) ; return name [ 0 ] . toUpperCase ( ) + name . slice ( 1 ) ; } export function getJavaPackagePath ( projectPath , packageName ) { return path . join ( projectPath , 'src' , 'main' , 'java' , ... packageName . split ( '.' ) ) ; } export function getJavaFunctionFilePath ( projectPath , packageName , functionName ) { return path . join ( getJavaPackagePath ( projectPath , packageName ) , getJavaClassName ( functionName ) + '.java' ) ; } export function validateMavenIdentifier ( input ) { if ( ! input ) { return localize ( 'inputEmptyError' , 'The input cannot be empty.' ) ; } else if ( ! /^[a-z\d_\-\.]+$/i . test ( input ) ) { return localize ( 'invalidMavenIdentifierError' , 'Id can only contain letters, digits, "_", "-" and ".".' ) ; } else { return undefined ; } }