Class FixedLocaleResolver<T>

  • Type Parameters:
    T - The context object which will be used to resolve the locale
    All Implemented Interfaces:
    Ordered, LocaleResolver<T>

    public class FixedLocaleResolver<T>
    extends java.lang.Object
    implements LocaleResolver<T>
    Generic implementation of LocaleResolver for fixed locale resolution.
    Since:
    2.3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedLocaleResolver​(java.util.Locale locale)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.util.Locale> resolve​(T context)
      Resolves the locale for the given context.
      java.util.Locale resolveOrDefault​(T context)
      Resolves the local or returns the default locale.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • locale

        protected final java.util.Locale locale
    • Constructor Detail

      • FixedLocaleResolver

        public FixedLocaleResolver​(java.util.Locale locale)
        Parameters:
        locale - fixed locale
    • Method Detail

      • resolve

        @NonNull
        public java.util.Optional<java.util.Locale> resolve​(@NonNull
                                                            T context)
        Description copied from interface: LocaleResolver
        Resolves the locale for the given context.
        Specified by:
        resolve in interface LocaleResolver<T>
        Parameters:
        context - The context to retrieve the locale from
        Returns:
        The locale
      • resolveOrDefault

        @NonNull
        public java.util.Locale resolveOrDefault​(@NonNull
                                                 T context)
        Description copied from interface: LocaleResolver
        Resolves the local or returns the default locale.
        Specified by:
        resolveOrDefault in interface LocaleResolver<T>
        Parameters:
        context - The context
        Returns:
        The locale