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 newParameterizedPathinstance from the suppliedPathParameterizedPath(String path) Builds thisParameterizedPathfrom the supplied raw string.ParameterizedPath(List<String> components) Builds thisParameterizedPathfrom the supplied components. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the components of the underlyingPathwhich are parameterized.getRaw()Gets the underlying rawPathinstance.inthashCode()booleanChecks if thisParameterizedPathmatches the suppliedPath.Resolves all parameters in thisParameterizedPathwith the supplied mapping of parameters.toString()
-
Constructor Details
-
ParameterizedPath
Builds thisParameterizedPathfrom the supplied raw string. This usesPath(String)- Parameters:
path- the unparsed path
-
ParameterizedPath
Builds thisParameterizedPathfrom the supplied components. This usesPath(List)- Parameters:
components- the list of path components
-
ParameterizedPath
Creates a newParameterizedPathinstance 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 rawPathinstance.- Returns:
- the
Pathinstance
-
getParameters
Gets the components of the underlyingPathwhich are parameterized.- Returns:
- a listing of all parameters, stripped of the curly braces
-
resolve
Resolves all parameters in thisParameterizedPathwith 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
Pathinstance, never null - Throws:
IllegalArgumentException- if the supplied resolver cannot resolve the parameters
-
matches
Checks if thisParameterizedPathmatches the suppliedPath. APathmatches thisParameterizedPathif 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> Pathmust 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- thePathwhich matches this- Returns:
- the mapping of parameter names to the supplied
Path - Throws:
IllegalArgumentException- if thePathdoes not match
-
equals
-
hashCode
public int hashCode() -
toString
-