Package io.micronaut.web.router
Interface RouteBuilder.UriNamingStrategy
-
- All Known Implementing Classes:
ConfigurableUriNamingStrategy,HyphenatedUriNamingStrategy
- Enclosing interface:
- RouteBuilder
public static interface RouteBuilder.UriNamingStrategyA 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.BookControllervalue is/bookresolveUri(Class, PropertyConvention)- Where type isexample.BookControllervalue is/book{/id}
Implementers can override to provide other strategies such as pluralization etc.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.lang.StringnormalizeUri(java.lang.String uri)Normalizes a URI.default java.lang.StringresolveUri(io.micronaut.inject.BeanDefinition<?> beanDefinition)Resolve the URI to use for the given type.default java.lang.StringresolveUri(java.lang.Class<?> type)Resolve the URI to use for the given type.default java.lang.StringresolveUri(java.lang.Class type, io.micronaut.core.naming.conventions.PropertyConvention id)Resolve the URI to use for the given type and route id.default java.lang.StringresolveUri(java.lang.String property)Resolve the URI to use for the given type.
-
-
-
Method Detail
-
resolveUri
default java.lang.String resolveUri(java.lang.Class<?> type)
Resolve the URI to use for the given type.- Parameters:
type- The type- Returns:
- The URI to use
-
resolveUri
@NonNull default java.lang.String resolveUri(io.micronaut.inject.BeanDefinition<?> beanDefinition)
Resolve the URI to use for the given type.- Parameters:
beanDefinition- The type- Returns:
- The URI to use
-
resolveUri
@NonNull default java.lang.String resolveUri(java.lang.String property)
Resolve the URI to use for the given type.- Parameters:
property- The property- Returns:
- The URI to use
-
resolveUri
@NonNull default java.lang.String resolveUri(java.lang.Class type, io.micronaut.core.naming.conventions.PropertyConvention id)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
default java.lang.String normalizeUri(@Nullable java.lang.String uri)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
-
-