Class StringParserUtils
java.lang.Object
edu.university.ecs.lab.intermediate.utils.StringParserUtils
Utility class for parsing strings.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
findPackage
(com.github.javaparser.ast.CompilationUnit cu) Find the package name in the given compilation unit.static String
mergePaths
(String classPath, String methodPath) Merge the given class and method paths into a single path.static String
Remove start/end quotations from the given string.static String
Simplifies all path arguments to {?}.
-
Method Details
-
removeOuterQuotations
Remove start/end quotations from the given string.ex: "abcde" --> abcde
- Parameters:
s
- the string to remove quotations from- Returns:
- the string with quotations removed
-
mergePaths
Merge the given class and method paths into a single path.ex: /abc/def and ghi/jkl --> abc/def/ghi/jkl
- Parameters:
classPath
- the class base (api) pathmethodPath
- the method (api) path- Returns:
- the merged path
-
findPackage
Find the package name in the given compilation unit.- Parameters:
cu
- the compilation unit- Returns:
- the package name else null if not found
-
simplifyEndpointURL
Simplifies all path arguments to {?}.- Parameters:
url
- the endpoint URL- Returns:
- the simplified endpoint URL
-