Package org.jbehave.core.io
Class CodeLocations
java.lang.Object
org.jbehave.core.io.CodeLocations
Collection of utility methods to create code location URLs
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic URLcodeLocationFromClass(Class<?> codeLocationClass) Creates a code location URL from a classstatic URLcodeLocationFromPath(String filePath) Creates a code location URL from a file pathstatic URLCreates a code location URL from a URLstatic StringgetPathFromURL(URL url) Get absolute path from URL objects starting with file: This method takes care of decoding %-encoded chars, e.g.
-
Constructor Details
-
CodeLocations
public CodeLocations()
-
-
Method Details
-
codeLocationFromClass
Creates a code location URL from a class- Parameters:
codeLocationClass- the class- Returns:
- A URL created from Class
- Throws:
CodeLocations.InvalidCodeLocation- if URL creation fails
-
codeLocationFromPath
Creates a code location URL from a file path- Parameters:
filePath- the file path- Returns:
- A URL created from File
- Throws:
CodeLocations.InvalidCodeLocation- if URL creation fails
-
codeLocationFromURL
Creates a code location URL from a URL- Parameters:
url- the URL external form- Returns:
- A URL created from URL
- Throws:
CodeLocations.InvalidCodeLocation- if URL creation fails
-
getPathFromURL
Get absolute path from URL objects starting with file: This method takes care of decoding %-encoded chars, e.g. %20 -> space etc Since we do not use a File object, the system specific path encoding is not used (e.g. C:\ on Windows). This is necessary to facilitate the removal of a class file with path in codeLocationFromClass- Parameters:
url- the file-URL- Returns:
- String absolute decoded path
- Throws:
CodeLocations.InvalidCodeLocation- if URL contains format errors
-