public final class YangIoUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addPackageInfo(File path,
String classInfo,
String pack,
boolean isChildNode,
YangPluginConfig pluginConfig)
Adds package info file for the created directory.
|
static File |
createDirectories(String path)
Creates the directory structure.
|
static void |
deleteDirectory(String dir)
Cleans the generated directory if already exist in source folder.
|
static String |
getAbsolutePackagePath(String baseCodeGenPath,
String pathOfJavaPkg)
Returns the absolute path of the package in canonical form.
|
static String |
getCamelCase(String yangIdentifier,
YangToJavaNamingConflictUtil conflictResolver)
Returns the YANG identifier name as java identifier.
|
static String |
getCapitalCase(String yangIdentifier)
Returns the YANG identifier name as java identifier with first letter
in capital.
|
static String |
getDirectory(String baseCodeGenPath,
String pathOfJavaPkg)
Returns the directory path of the package in canonical form.
|
static String |
getJavaPackageFromPackagePath(String packagePath)
Returns the java Package from package path.
|
static String |
getPackageDirPathFromJavaJPackage(String packagePath)
Returns the directory path corresponding to java package.
|
static String |
getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver)
Prefix for adding with identifier and namespace, when it is a java keyword or starting with digits.
|
static String |
getSmallCase(String yangIdentifier)
Returns the YANG identifier name as java identifier with first letter
in small.
|
static void |
insertDataIntoJavaFile(File file,
String data)
Inserts data in the generated file.
|
static void |
mergeJavaFiles(File appendFile,
File srcFile)
Merges the temp java files to main java files.
|
static String |
parsePkg(String pack)
Parses package and returns updated package.
|
static String |
replaceLast(String valueString,
String removalString,
String replacingString)
Replaces the last occurrence of a string with a given string.
|
static void |
searchAndDeleteTempDir(String root)
Searches and deletes generated temporary directories.
|
static String |
trimAtLast(String valueString,
String removalString)
Removes extra char from the string.
|
static File |
validateLineLength(File dataFile)
Validates a line size in given file whether it is having more then 120 characters.
|
static String |
whenSpaceIsPresent(String line,
int lineSize) |
public static File createDirectories(String path) throws IOException
path - directory pathIOException - when fails to do IO operationspublic static void addPackageInfo(File path, String classInfo, String pack, boolean isChildNode, YangPluginConfig pluginConfig) throws IOException
path - directory pathclassInfo - class info for the packagepack - package of the directoryisChildNode - is it a child nodepluginConfig - plugin configurationsIOException - when fails to create package info filepublic static String parsePkg(String pack)
pack - package needs to be updatedpublic static void deleteDirectory(String dir) throws IOException
dir - generated directory in previous buildIOException - when failed to delete directorypublic static void searchAndDeleteTempDir(String root) throws IOException
root - root directoryIOException - when fails to do IO operations.public static String trimAtLast(String valueString, String removalString)
valueString - string to be trimmedremovalString - extra charspublic static String replaceLast(String valueString, String removalString, String replacingString)
valueString - string under operationremovalString - string to be replacedreplacingString - string with which replacement is to be donepublic static String getDirectory(String baseCodeGenPath, String pathOfJavaPkg)
baseCodeGenPath - base path where the generated files needs to be
putpathOfJavaPkg - java package of the file being generatedpublic static String getAbsolutePackagePath(String baseCodeGenPath, String pathOfJavaPkg)
baseCodeGenPath - base path where the generated files needs to be
putpathOfJavaPkg - java package of the file being generatedpublic static void mergeJavaFiles(File appendFile, File srcFile) throws IOException
appendFile - temp filesrcFile - main fileIOException - when fails to append contentspublic static void insertDataIntoJavaFile(File file, String data) throws IOException
file - file in which need to be inserteddata - data which need to be insertedIOException - when fails to insert into filepublic static File validateLineLength(File dataFile) throws IOException
dataFile - file in which need to verify all lines.IOException - when fails to do IO operations.public static String getJavaPackageFromPackagePath(String packagePath)
packagePath - package pathpublic static String getPackageDirPathFromJavaJPackage(String packagePath)
packagePath - package pathpublic static String getSmallCase(String yangIdentifier)
yangIdentifier - identifier in YANG file.public static String getCapitalCase(String yangIdentifier)
yangIdentifier - identifier in YANG filepublic static String getCamelCase(String yangIdentifier, YangToJavaNamingConflictUtil conflictResolver)
yangIdentifier - identifier in YANG fileconflictResolver - object of YANG to java naming conflict utilpublic static String getPrefixForIdentifier(YangToJavaNamingConflictUtil conflictResolver)
conflictResolver - object of YANG to java naming conflict utilCopyright © 2016. All rights reserved.