Package io.micronaut.http.server.binding
Class LocaleArgumentBinder
java.lang.Object
io.micronaut.http.server.binding.LocaleArgumentBinder
- All Implemented Interfaces:
ArgumentBinder<Locale,
,HttpRequest<?>> TypeArgumentBinder<Locale,
,HttpRequest<?>> RequestArgumentBinder<Locale>
,TypedRequestArgumentBinder<Locale>
@Singleton
public class LocaleArgumentBinder
extends Object
implements TypedRequestArgumentBinder<Locale>
Binds
Locale
arguments in controller methods using
the LocaleResolver
.- Since:
- 2.3.0
- Author:
- James Kleeh
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.core.bind.ArgumentBinder
ArgumentBinder.BindingResult<T>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbind
(ArgumentConversionContext<Locale> context, HttpRequest<?> source) Bind the given argument from the given source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.bind.binders.TypedRequestArgumentBinder
matches, superTypes
-
Constructor Details
-
LocaleArgumentBinder
- Parameters:
localeResolver
- The locale resolver
-
-
Method Details
-
argumentType
- Specified by:
argumentType
in interfaceTypeArgumentBinder<Locale,
HttpRequest<?>> - Returns:
- The argument type.
-
bind
public ArgumentBinder.BindingResult<Locale> bind(ArgumentConversionContext<Locale> context, HttpRequest<?> source) Description copied from interface:ArgumentBinder
Bind the given argument from the given source.- Specified by:
bind
in interfaceArgumentBinder<Locale,
HttpRequest<?>> - Parameters:
context
- TheArgumentConversionContext
source
- The source- Returns:
- An
Optional
of the value. If no binding was possibleOptional.empty()
-