Class ClasspathResourceSource
- All Implemented Interfaces:
Serializable
,TestSource
TestSource
with an optional position.- Since:
- 1.0
- See Also:
ClasspathResourceSelector
, Serialized Form
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static ClasspathResourceSource
Create a newClasspathResourceSource
using the supplied classpath resource name.static ClasspathResourceSource
from(String classpathResourceName, FilePosition filePosition)
Create a newClasspathResourceSource
using the supplied classpath resource name andFilePosition
.static ClasspathResourceSource
Create a newClasspathResourceSource
from the suppliedURI
.Get the name of the source classpath resource.Get theFilePosition
, if available.int
hashCode()
toString()
-
Field Details
-
CLASSPATH_SCHEME
- Since:
- 1.3
- See Also:
- Constant Field Values
-
-
Method Details
-
from
Create a newClasspathResourceSource
using the supplied classpath resource name.The name of a classpath resource must follow the semantics for resource paths as defined in
ClassLoader.getResource(String)
.If the supplied classpath resource name is prefixed with a slash (
/
), the slash will be removed.- Parameters:
classpathResourceName
- the name of the classpath resource; nevernull
or blank- See Also:
ClassLoader.getResource(String)
,ClassLoader.getResourceAsStream(String)
,ClassLoader.getResources(String)
-
from
public static ClasspathResourceSource from(String classpathResourceName, FilePosition filePosition)Create a newClasspathResourceSource
using the supplied classpath resource name andFilePosition
.The name of a classpath resource must follow the semantics for resource paths as defined in
ClassLoader.getResource(String)
.If the supplied classpath resource name is prefixed with a slash (
/
), the slash will be removed.- Parameters:
classpathResourceName
- the name of the classpath resource; nevernull
or blankfilePosition
- the position in the classpath resource; may benull
-
from
Create a newClasspathResourceSource
from the suppliedURI
.The
path
component of theURI
(excluding the query) will be used as the classpath resource name. The query component of theURI
, if present, will be used to retrieve theFilePosition
viaFilePosition.fromQuery(String)
.- Parameters:
uri
- theURI
for the classpath resource; nevernull
- Returns:
- a new
ClasspathResourceSource
; nevernull
- Throws:
PreconditionViolationException
- if the suppliedURI
isnull
or if the scheme of the suppliedURI
is not equal to theCLASSPATH_SCHEME
- Since:
- 1.3
- See Also:
CLASSPATH_SCHEME
-
getClasspathResourceName
Get the name of the source classpath resource.The name of a classpath resource follows the semantics for resource paths as defined in
ClassLoader.getResource(String)
. -
getPosition
Get theFilePosition
, if available. -
equals
-
hashCode
public int hashCode() -
toString
-