Class PathTemplates
java.lang.Object
com.arc_e_tect.gradle.shadow.model.PathTemplates
Utility methods for normalising and combining Spring MVC / OpenAPI path templates so that
they can be compared regardless of superficial formatting differences.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisPlaceholder(String segment) Returns whethersegmentis a Spring/OpenAPI path-variable placeholder, i.e.static StringJoins a base path and a sub-path into a single normalised path template.static StringNormalises a path template: ensures a leading"/", collapses repeated"/"separators, strips path-variable regex constraints (e.g.
-
Method Details
-
join
Joins a base path and a sub-path into a single normalised path template.- Parameters:
base- the base path, e.g. a class-level@RequestMappingvalue; may be blanksub- the sub-path, e.g. a method-level mapping value; may be blank- Returns:
- the combined, normalised path, always starting with
"/"
-
normalize
Normalises a path template: ensures a leading"/", collapses repeated"/"separators, strips path-variable regex constraints (e.g."{id:[0-9]+}"becomes"{id}"), and removes a trailing"/"(other than for the root path"/"itself).- Parameters:
path- the raw path template- Returns:
- the normalised path template
-
isPlaceholder
Returns whethersegmentis a Spring/OpenAPI path-variable placeholder, i.e. wrapped in curly braces, e.g."{id}".- Parameters:
segment- a single,"/"-delimited path segment- Returns:
truewhensegmentis a placeholder segment
-