Class ParameterizedPath
java.lang.Object
dev.getelements.elements.sdk.cluster.path.ParameterizedPath
- All Implemented Interfaces:
Serializable
Similar to
Path
, but supports the parsing of parameters to the path. Final Path
instances may be generated by applying the parameters specified.
Created by patricktwohig on 8/16/17.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionParameterizedPath
(Path raw) Creates a newParameterizedPath
instance from the suppliedPath
ParameterizedPath
(String path) Builds thisParameterizedPath
from the supplied raw string.ParameterizedPath
(List<String> components) Builds thisParameterizedPath
from the supplied components. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the components of the underlyingPath
which are parameterized.getRaw()
Gets the underlying rawPath
instance.int
hashCode()
boolean
Checks if thisParameterizedPath
matches the suppliedPath
.Resolves all parameters in thisParameterizedPath
with the supplied mapping of parameters.toString()
-
Constructor Details
-
ParameterizedPath
Builds thisParameterizedPath
from the supplied raw string. This usesPath(String)
- Parameters:
path
- the unparsed path
-
ParameterizedPath
Builds thisParameterizedPath
from the supplied components. This usesPath(List)
- Parameters:
components
- the list of path components
-
ParameterizedPath
Creates a newParameterizedPath
instance from the suppliedPath
- Parameters:
raw
- the raw path- Throws:
IllegalArgumentException
- ifPath.isWildcard()
returns true, or if parameters are duplicated
-
-
Method Details
-
getRaw
Gets the underlying rawPath
instance.- Returns:
- the
Path
instance
-
getParameters
Gets the components of the underlyingPath
which are parameterized.- Returns:
- a listing of all parameters, stripped of the curly braces
-
resolve
Resolves all parameters in thisParameterizedPath
with the supplied mapping of parameters.- Parameters:
parameters
- the parameters map- Returns:
- a fully resolved
Path
-
resolve
Resolves this instance against the suppliedFunction<String,
which provides a mapping of parameters to their values.String> - Parameters:
resolver
- the resolver, which may return null if the parameter is unresolved.- Returns:
- the resolved
Path
instance, never null - Throws:
IllegalArgumentException
- if the supplied resolver cannot resolve the parameters
-
matches
Checks if thisParameterizedPath
matches the suppliedPath
. APath
matches thisParameterizedPath
if it has the same number of components and each component is equal to the patch or corresponds to a parameter. -
extract
Given the provided non-parameterized path, this will return aMap<String,
of the value of the parameters. The suppliedString> Path
must match this instance usingmatches(Path)
for this method to succeed. The ordering of the returnedMap<String,
will be returned in the order in which the mapping matched the originalString> Path
.- Parameters:
path
- thePath
which matches this- Returns:
- the mapping of parameter names to the supplied
Path
- Throws:
IllegalArgumentException
- if thePath
does not match
-
equals
-
hashCode
public int hashCode() -
toString
-