Package io.micronaut.web.router
Interface RouteBuilder.UriNamingStrategy
- All Known Implementing Classes:
ConfigurableUriNamingStrategy
,HyphenatedUriNamingStrategy
- Enclosing interface:
- RouteBuilder
public static interface RouteBuilder.UriNamingStrategy
A URI naming strategy is used to dictate the default name to use when building a URI for a class.
The default strategy is as follows:
resolveUri(Class)
- Where type isexample.BookController
value is/book
resolveUri(Class, PropertyConvention)
- Where type isexample.BookController
value is/book{/id}
Implementers can override to provide other strategies such as pluralization etc.
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
normalizeUri
(@Nullable String uri) Normalizes a URI.resolveUri
(BeanDefinition<?> beanDefinition) Resolve the URI to use for the given type.default String
resolveUri
(Class<?> type) Resolve the URI to use for the given type.resolveUri
(Class<?> type, PropertyConvention id) Resolve the URI to use for the given type and route id.resolveUri
(String property) Resolve the URI to use for the given type.
-
Method Details
-
resolveUri
Resolve the URI to use for the given type.- Parameters:
type
- The type- Returns:
- The URI to use
-
resolveUri
Resolve the URI to use for the given type.- Parameters:
beanDefinition
- The type- Returns:
- The URI to use
-
resolveUri
Resolve the URI to use for the given type.- Parameters:
property
- The property- Returns:
- The URI to use
-
resolveUri
Resolve the URI to use for the given type and route id.- Parameters:
type
- The typeid
- the route id- Returns:
- The URI to use
-
normalizeUri
Normalizes a URI.Ensures the string: 1) Does not end with a / 2) Starts with a /
- Parameters:
uri
- The URI- Returns:
- The normalized URI or null
-