Package org.spongepowered.api.resource
Interface ResourcePath
- All Superinterfaces:
Comparable<ResourcePath>
- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionbaseName()
Gets the base name of the file without any parent elements or extensions.Gets the extension of the file if any.key()
Gets the backingResourceKey
for this path object.name()
Gets the name of the file without any parent elements.default String
Gets the namespace portion of this resource path.static ResourcePath
Creates a resource path.static ResourcePath
of
(ResourceKey key) Creates a new path using the givenResourceKey
.static ResourcePath
Creates a resource path from a plugin container.parent()
static ResourcePath
Parses a path from a string, generally formatted "namespace:path".default String
path()
Gets the path portion of this resource path.Resolves a path from the current location using the specified children.resolveSibling
(String sibling, String... children) Resolves a sibling of this path.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
of
Creates a resource path.- Parameters:
namespace
- The namespacepath
- The path within the supplied namespace- Returns:
- A new resource path
- See Also:
-
of
Creates a resource path from a plugin container.- Parameters:
container
- The plugin containerpath
- The path within the supplied namespace- Returns:
- A new resource path
- See Also:
-
parse
Parses a path from a string, generally formatted "namespace:path".If no namespace is found in
value
thenminecraft
will be the namespace.- Parameters:
value
- The value- Returns:
- A new resource path
- See Also:
-
of
Creates a new path using the givenResourceKey
.- Parameters:
key
- The key object- Returns:
- A new path
-
key
ResourceKey key()Gets the backingResourceKey
for this path object.- Returns:
- The key object
-
namespace
Gets the namespace portion of this resource path.- Returns:
- The namespace
- See Also:
-
path
Gets the path portion of this resource path.- Returns:
- The path
- See Also:
-
parent
Optional<ResourcePath> parent()- Returns:
- The parent path or
Optional.empty()
if there is none
-
resolve
Resolves a path from the current location using the specified children.- Parameters:
first
- The first childchildren
- The rest of the children- Returns:
- The resolvedIllegalArgumentException path
- Throws:
IllegalArgumentException
- If the path is invalid
-
resolveSibling
Resolves a sibling of this path.- Parameters:
sibling
- The sibling's namechildren
- The optional children of the sibling- Returns:
- The sibling resource path
- Throws:
IllegalArgumentException
- If the path is invalid
-
name
String name()Gets the name of the file without any parent elements.- Returns:
- The file name
-
baseName
String baseName()Gets the base name of the file without any parent elements or extensions.- Returns:
- The base file name
-
extension
String extension()Gets the extension of the file if any. If the file has no extension, an empty string is returned.- Returns:
- The file extension
-