Class MessageSourceMessageComparator<T>
java.lang.Object
net.solarnetwork.node.settings.support.MessageSourceMessageComparator<T>
- Type Parameters:
T- the comparison type
- All Implemented Interfaces:
Comparator<T>
- Direct Known Subclasses:
SettingSpecifierProviderFactoryMessageComparator,SettingSpecifierProviderMessageComparator
Abstract
Comparator for comparing two resolved messages.- Since:
- 1.74
- Version:
- 1.0
- Author:
- matt
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageSourceMessageComparator(Locale locale) Constructor.MessageSourceMessageComparator(Locale locale, String messageKey) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintcompareMessageKeyValues(org.springframework.context.MessageSource leftMessageSource, String leftDefault, org.springframework.context.MessageSource rightMessageSource, String rightDefault) Compare two resolved message keys in a case-insensitive manner.Get the locale.Get the message key.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
DEFAULT_MESSAGE_KEY
The defaultmessageKeyproperty value.- See Also:
-
-
Constructor Details
-
MessageSourceMessageComparator
Constructor.This defaults the
messageKeytoDEFAULT_MESSAGE_KEY.- Parameters:
locale- the desired locale of the messages to compare
-
MessageSourceMessageComparator
Constructor.- Parameters:
locale- the desired locale of the messages to comparemessageKey- the message key to compare
-
-
Method Details
-
compareMessageKeyValues
public int compareMessageKeyValues(org.springframework.context.MessageSource leftMessageSource, String leftDefault, org.springframework.context.MessageSource rightMessageSource, String rightDefault) Compare two resolved message keys in a case-insensitive manner.- Parameters:
leftMessageSource- the first message source, or nullleftDefault- the first default message, ifleftMessageSourceis not available or does not resolve a value forgetMessageKey()rightMessageSource- the second message source, or nullrightDefault- the second default message, ifrightMessageSourceis not available or does not resolve a value forgetMessageKey()- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
-
getLocale
Get the locale.- Returns:
- the locale
-
getMessageKey
Get the message key.- Returns:
- the messageKey
-